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:
$ npm install hexo-cli -g
$ hexo init blog
$ cd blog
$ npm install
$ hexo server
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:
git clone https://github.com/cofess/hexo-theme-pure.git themes/pure
and fix the blog / _config.yml configuration file:
So has successfully applied a new theme already. Try seeing the results.
To add a page or a post, run the following command:
hexo new [layout] <title>
The layout will look like this:
|post||source / _posts|
|draft||source / _drafts|
I will add one post to the website with the command:
hexo new post first_post
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:
title: First post
date: 2020-05-31 00:51:14
this is first post
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 :
$ npm install hexo-deployer-git -save
To deploy, run the following 2 commands:
$ hexo generate
$ hexo deploy
And the result is here: https://phamtuananh1996.github.io/
It is done !
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