{"id":246,"date":"2017-06-20T08:44:25","date_gmt":"2017-06-20T00:44:25","guid":{"rendered":"https:\/\/blog.jsjs.org\/?p=246"},"modified":"2017-06-20T08:44:25","modified_gmt":"2017-06-20T00:44:25","slug":"create-and-host-your-blog-for-free-with-hexo-github","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=246","title":{"rendered":"Create and host your blog for free with hexo &#038; Github"},"content":{"rendered":"<p>If you\u2019ve ever wondered how to start a blog, you\u2019re in luck because that\u2019s exactly what I\u2019m going to show you today. Starting your own blog doesn\u2019t have to be complicated or difficult. In fact, more and more people are starting blogs every day. It seems that just about every person or business has a blog these days.<\/p>\n<p>I am going to show you exactly how to start a blog with the <code class=\"highlighter-rouge\">hexo<\/code>, which can be used from any computer, tablet, or smartphone. In this post I am going to show you exactly how to create a blog so that you get the most out of it.<\/p>\n<h2 id=\"what-is-hexo\">What is Hexo?<\/h2>\n<p>Hexo is a fast, simple and powerful blog framework. You write posts in Markdown (or other languages) and Hexo generates static files with a beautiful theme in seconds.<\/p>\n<p>Installing Hexo is quite easy. However, you do need to have <code class=\"highlighter-rouge\">Nodejs<\/code> &amp; <code class=\"highlighter-rouge\">Git<\/code> installed first.<\/p>\n<p>In order to install <code class=\"highlighter-rouge\">Nodejs<\/code> you can see <a href=\"https:\/\/malekbenz.com\/blog\/2015\/12\/22\/install-run-your-first-application-nodejs\">Install &amp; run your first application Nodejs<\/a>.<\/p>\n<p>In order to install <code class=\"highlighter-rouge\">Git<\/code> you can see <a href=\"https:\/\/git-scm.com\/\">https:\/\/git-scm.com\/ <\/a>.<\/p>\n<h2 id=\"install-hexo\">Install Hexo?<\/h2>\n<p>Once all the requirements are installed, you can install Hexo.<\/p>\n<div class=\"highlighter-rouge\">\n<pre class=\"highlight\"><code>    $ npm install -g hexo-cli\n\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-version.png\" alt=\"CMD\" \/><\/p>\n<h2 id=\"create-a-blog\">Create a blog<\/h2>\n<p>Now that hexo is installed run the following commands to initialise Hexo project<\/p>\n<div class=\"highlighter-rouge\">\n<pre class=\"highlight\"><code>    $ hexo init myblog\n    $ cd myblog\n    $ npm install\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-project.png\" alt=\"CMD\" \/><\/p>\n<p>You can modify site settings in <code class=\"highlighter-rouge\">_config.yml<\/code>. for the sake of simplicity we\u2019re only modify the <code class=\"highlighter-rouge\">Title<\/code> and <code class=\"highlighter-rouge\">author<\/code> name .<\/p>\n<h2 id=\"run-the-blog\">Run the Blog<\/h2>\n<p>Run the server:<\/p>\n<div class=\"highlighter-rouge\">\n<pre class=\"highlight\"><code>    $ hexo server\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-server.png\" alt=\"CMD\" \/><\/p>\n<p>launch your browser and navigate to <a href=\"http:\/\/localhost:4000\/\">http:\/\/localhost:4000<\/a>.<\/p>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-preview.png\" alt=\"CMD\" \/><\/p>\n<p>Voila your first blog is working.<\/p>\n<h2 id=\"create-a-new-post\">Create a new post<\/h2>\n<p>Create a new post is very simlpe all what you have to do is :<\/p>\n<div class=\"highlighter-rouge\">\n<pre class=\"highlight\"><code>    $ hexo new \"My Fist Post with hexo\"\n\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-create-post.png\" alt=\"CMD\" \/><\/p>\n<p>Update the file using <code class=\"highlighter-rouge\">Markdown<\/code> language:<\/p>\n<div class=\"highlighter-rouge\">\n<pre class=\"highlight\"><code>---\ntitle: My Fist Post with hexo\ndate: 2016-09-25 20:03:25\ntags:\n---\nThis my first post using [Hexo](https:\/\/hexo.io\/)!\n\n## First title\n\n### a first subtitile\n\n    ``` bash\n    $ hexo new \"My New Post\"\n    ```\n\n## Second title\n\nMore info: [Writing](https:\/\/hexo.io\/docs\/writing.html)\n\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-content-post.png\" alt=\"CMD\" \/><\/p>\n<p>Run the server again:<\/p>\n<div class=\"highlighter-rouge\">\n<pre class=\"highlight\"><code>    $ hexo server\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-preview1.png\" alt=\"CMD\" \/><\/p>\n<h2 id=\"deployment-on-github\">Deployment on Github<\/h2>\n<p>Now what about Deployment, it\u2019s exactly what we are going to do, first Create new Github repository :<\/p>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-git-project.png\" alt=\"CMD\" \/><\/p>\n<p>Click <code class=\"highlighter-rouge\">settings<\/code><\/p>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-git-project-prop.png\" alt=\"CMD\" \/><\/p>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-git-pages.png\" alt=\"CMD\" \/><\/p>\n<p>Then install hexo-deployer-git:<\/p>\n<div class=\"highlighter-rouge\">\n<pre class=\"highlight\"><code>$ npm install hexo-deployer-git --save\n\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-deployer-git.png\" alt=\"CMD\" \/><\/p>\n<p>Click clone or download button:<\/p>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-git-clone.png\" alt=\"CMD\" \/><\/p>\n<p>Update <code class=\"highlighter-rouge\">_config.yaml<\/code> file :<\/p>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-git-config.yaml.png\" alt=\"CMD\" \/><\/p>\n<p>It\u2019s time for deployement :<\/p>\n<div class=\"highlighter-rouge\">\n<pre class=\"highlight\"><code>    $ hexo deploy\n\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-deployer.png\" alt=\"CMD\" \/><\/p>\n<p>To preview launch your browser.<\/p>\n<p><img decoding=\"async\" class=\"img-responsive\" src=\"https:\/\/malekbenz.com\/images\/hexo\/hexo-preview-web.png\" alt=\"CMD\" \/><\/p>\n<p>You can get see the blog on <a href=\"https:\/\/malektrainer.github.io\/\">https:\/\/malektrainer.github.io\/<\/a>.<\/p>\n<p>You can find source code on <a href=\"https:\/\/github.com\/malektrainer\/myblog\">https:\/\/github.com\/malektrainer\/myblog<\/a>.<\/p>\n<blockquote>\n<h2 id=\"congratulations-you-have-now-created-a-blog\">Congratulations! You have now created a blog.<\/h2>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve ever wondered how to start a blog, you\u2019re in luck because that\u2019s exactly what I\u2019m going to show [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-246","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=246"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/246\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}