Setup your personal markdown blog using hexo, deployed to github
To setup your personal programming blog (based on markdown) using hexo, you can follow these steps :
Installing Git, Node and Hexo
This is a pretty straight forward step so i will assume that you have them installed.
The documentation here can be helful to you for the same.Initialize you blog
To setup you blog, you need to create an initial hexo project.
|
|
After this, you should see a <project-name> folder with the following structure.
.
├── _config.yml
├── package.json
├── scaffolds
├ ├── draft.md
├ ├── page.md
├ ├── photo.md
├ └── post.md
├── source
├ ├── _drafts
├ └── _posts
├── themes
├ └── …
└── README.md
Configure your blog
The configuration file is a straight forward yaml file located at <project-folder>/_config.yml
You can follow the sample code written below to configure yours.
|
|
Installing a theme
You can skip this step, if the theme you configured was the default light theme.
In other case, run the following :
|
|
Once the cloning is done, ensure that the theme is configured in the <project-folder>/_config.yml.
Any theme specific configuration can be set in the <project-folder>/themes/<theme-name>/_config.yml file
Installing a plugin
You can install a plugin in a simple step :
|
|
Once the installation is done, ensure that the plugin is configured in the <project-folder>/_config.yml.
Create a blog post
You can create a blog post :
|
|
After you create your post, you should see a file named <post-title> in <project-folder>/source/_posts folder.
You can edit the file to write your post data in markdown. The documentation on markdown syntax could help you write better markdown code. A nice online markdown editor called markable can help you validate your markdown code.
To generate the static files
You need to generate the static HTML/CSS/JS files for your blog post :
|
|
To run a server locally
You can run a local server to checkout your blog. It will start based on the config parameters given in the <project-folder>/_config.yml file :
|
|
To deploy your blog to github repository
You need to create a repository named <github-username>.github.io in github before this step.
Also ensure that the github repository url is configured properly in the <project-folder>/_config.yml
Then do :
|
|
Now, you should be able to see your blog static files in the <github-username>.github.io repository. After 5-10 mins you should be able to see your blog hosted at http://<github-username>.github.io and your blogs atom feed at http://<github-username>.github.io/atom.xml