Build a super fast website with Hexo and github pages

Tram Ho

Preamble

What do you think about having your own personal blog. Both is a place to share your knowledge and also a channel for PR for yourself. But you don’t want to spend too much time rebuilding your blog from scratch and then choosing what backend technology to use and what to use. Then you have to spend a decent amount to rent hosting with the domain name. Not to mention that you are not a web developer?

With hexo and github pages will solve these problems for you!

What is hexo?

Hexo is a powerful blog framework, it creates static web simply and quickly using NodeJS. You can write articles in Markdown or other markup languages.

Start right away

With hexo, it is very simple to have a static website immediately with the following commands:

That’s it! Next, go to http: // localhost: 4000 and see the result:

And done. Very simple, right

Next is to choose a very shimmering template, hexo provides them available about 311 Themes spoiled for choice you can see here: https://hexo.io/themes/

I chose 1 theme and added it to my website: https://github.com/cofess/hexo-theme-pure

Next is the clone to and put in the blog / themes / pure directory:

and fix the blog / _config.yml configuration file:

So has successfully applied a new theme already. Try seeing the results.

So successful!

To add a page or a post, run the following command:

The layout will look like this:

LayoutPath
postsource / _posts
pagesource
draftsource / _drafts

I will add one post to the website with the command:

After running the command, it has created for us a file in the path blog source_posts first-post.md

Open this file and write the content:

Save and run and result:

1 post has appeared. Now copy the posts from viblo and only edit some content about the profile in the file blog themes pure_config.yml

So there is also the blog dew.

You can completely create other pages like page about …..

Deploy website on github pages

Creating Github Pages is quite simple, you must first have a Github account, create a new repo with the name in the format <github-username> .github.io, because my github username is phamtuananh1996 so I will create a repo with name is phamtuananh1996.github.io

Once Github Pages has been successfully created, our next job is to generate static web and deploy to Github Pages to host. Once deployed, the address to access your blog will be: <github-username> .github.io.

Generating static web and deploying becomes quite simple with Hexo, we just need to edit the blog / _config.yml file with the following content:

Change the username to your username.

Proceed to install the plugin hexo-deployer-git :

To deploy, run the following 2 commands:

And the result is here: https://phamtuananh1996.github.io/

It is done !

Conclude

It took less than 5 minutes for you to have a complete blog with hexo and github pages already. What are you waiting for without discovering hexo right away? Above I just introduced through the most basic functions only.

You can find out more at https://hexo.io/

Hi, Sincerely and decided to win

Share the news now

Source : Viblo