To create a new post or a new page, you can run the following command:
$ hexo new [layout] <title>
post is the default
layout, but you can supply your own. You can change the default layout by editing the
default_layout setting in
There are three default layouts in Hexo:
draft. Files created by each of them is saved to a different path. Newly created posts are saved to the
Don't process my posts!
If you don’t want your posts processed, you can set
layout: falsein front-matter.
By default, Hexo uses the post title as its filename. You can edit the
new_post_name setting in
_config.yml to change the default filename. For example,
:year-:month-:day-:title.md will prefix filenames with the post creation date. You can use the following placeholders:
||Post title (lower case, with spaces replaced by hyphens)|
||Created year, e.g.
||Created month (leading zeros), e.g.
||Created month (no leading zeros), e.g.
||Created day (leading zeros), e.g.
||Created day (no leading zeros), e.g.
Previously, we mentioned a special layout in Hexo:
draft. Posts initialized with this layout are saved to the
source/_drafts folder. You can use the
publish command to move drafts to the
publish works in a similar way to the
$ hexo publish [layout] <title>
Drafts are not displayed by default. You can add the
--draft option when running Hexo or enable the
render_drafts setting in
_config.yml to render drafts.
When creating posts, Hexo will build files based on the corresponding file in
scaffolds folder. For example:
$ hexo new photo "My Gallery"
When you run this command, Hexo will try to find
photo.md in the
scaffolds folder and build the post based on it. The following placeholders are available in scaffolds:
||File created date|
Hexo support posts written in any format, as long as the corresponding renderer plugin is installed.
For example, Hexo has
hexo-renderer-ejs installed by default, so you can write your posts in
markdown or in
ejs. If you have
hexo-renderer-pug installed, then you can even write your post in pug template language.
You can rename your posts and change to file extension from
.ejs, then Hexo will use
hexo-renderer-ejs to render that file, so do the other formats.