Loading...

Loading...

You can specify the permalinks for your site in _config.yml or in the front-matter for each post.

Variables

Besides the following variables, you can use any attributes in the permalink except :path and :permalink.

VariableDescription
:yearPublished year of posts (4-digit)
:monthPublished month of posts (2-digit)
:i_monthPublished month of posts (Without leading zeros)
:dayPublished day of posts (2-digit)
:i_dayPublished day of posts (Without leading zeros)
:hourPublished hour of posts (2-digit)
:minutePublished minute of posts (2-digit)
:secondPublished second of posts (2-digit)
:timestampTimestamp of post’s published date
:titleFilename (relative to “source/_posts/” folder)
:nameFilename
:post_titlePost title
:idPost ID (not persistent across cache reset)
:categoryCategories. If the post is uncategorized, it will use the default_category value.
:hashSHA1 hash of filename (same as :title) and date (12-hexadecimal)

You can define the default value of each variable in the permalink through the permalink_defaults setting:

permalink_defaults:
  lang: en

Examples

source/_posts/hello-world.md
title: Hello World date: 2013-07-14 17:01:34 categories: - foo - bar
SettingResult
:year/:month/:day/:title/2013/07/14/hello-world/
:year-:month-:day-:title.html2013-07-14-hello-world.html
:category/:title/foo/bar/hello-world/
:title-:hash/hello-world-a2c8ac003b43/
source/_posts/lorem/hello-world.md
title: Hello World date: 2013-07-14 17:01:34 categories: - foo - bar
SettingResult
:year/:month/:day/:title/2013/07/14/lorem/hello-world/
:year/:month/:day/:name/2013/07/14/hello-world/

Multi-language Support

To create a multi-language site, you can modify the new_post_name and permalink settings like this:

new_post_name: :lang/:title.md
permalink: :lang/:title/

When you create a new post, the post will be saved to:

$ hexo new "Hello World" --lang tw
# => source/_posts/tw/Hello-World.md

and the URL will be:

http://localhost:4000/tw/hello-world/
Comments
Data Loading...