Getting started with Hexo

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Setup deployment to github

Install the hexo-deployer-git module using NPM and add the following bits of configuration to your _config.yml file to set it up:

Installation

1
$ npm install hexo-deployer-git --save

Options

1
2
3
4
5
deploy:
type: git
repo: https://github.com/yourusername/your-blog-url.github.io.git
branch: master
message: Default to Site updated {{ now('YYYY-MM-DD HH:mm:ss') }}

Replace the [username] bits with your username and save the configuration. your-blog-url.github.io.git has to be created previously into GitHub. Now you can run the following set of commands to generate and deploy your website:

Generate static files

Generate Markdown to HTML.

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

Just create a common npm script.

You can create a script in package.json file including above commands in one.

1
2
3
4
"scripts": {
"deploy": "hexo generate && hexo deploy",
"watch": "hexo server --draft --open"
}

More info: Deployment

Using a custom Domain (CNAME).

To use a custom domain for your Hexo website, e.g. blog.pablomagro.co.nz instead of pablomagro.github.io, then you need to create a file named CNAME to the hexo project source directory

1
2
source/CNAME
blog.pablomagro.co.nz

You will need to own this custom domain and set your domain to point to the actual web address.

For example:

GoDaddy Hosting

Enabling Disqus Comments

Register for a Disqus Account

In order to setup Disqus on your Hexo site you must first create a Disqus account by registering at the following link: https://disqus.com/profile/signup/.

Reed more from the following link.


Install additional plugins

hexo-renderer-marked

The hexo marked renderer is a markdown rendering engine that enables you to configure how your markdown should be processed. The module follows commonmark specs as much as possible.

More info: Rendered Marked

Installation

1
$ npm install hexo-renderer-marked --save

Options

You can configure this plugin in _config.yml.

1
2
3
4
5
6
7
8
9
# Marked renderer
marked:
gfm: true
pedantic: false
sanitize: false
tables: true
breaks: false
smartLists: true
smartypants: true

hexo-generator-category

If you like, you can include a page for every category you use on your weblog. Add a property to your markdown files that specify in which category the post belongs and install this module to generate a page for that category.

1
2
3
4
5
6
---
title: youtube-dl
tags: youtube-dl
categories: CLI
date: 2016-09-13 16:13:19
---

Installation

1
$ npm install hexo-generator-category --save

Options

You can configure this plugin in _config.yml.

1
2
category_generator:
per_page: 10

hexo-generator-tag

You can select a tag and go to a page listing all the posts that are tagged with that particular tag. The hexo-generator-tag module is required for this functionality, so I suggest you install this if you like to enable people to browse your site by tag.

Installation

1
$ npm install hexo-generator-tag --save

Options

You can configure this plugin in _config.yml.

1
2
tag_generator:
per_page: 10