您可以在配置中調(diào)整網(wǎng)站的永久鏈接。
除了下列變量外,您還可使用 Front-matter 中的所有屬性。
變量 | 描述 |
---|---|
:year |
文章的發(fā)表年份(4 位數(shù)) |
:month |
文章的發(fā)表月份(2 位數(shù)) |
:i_month |
文章的發(fā)表月份(去掉開頭的零) |
:day |
文章的發(fā)表日期 (2 位數(shù)) |
:i_day |
文章的發(fā)表日期(去掉開頭的零) |
:title |
文件名稱 |
:id |
文章 ID |
:category |
分類。如果文章沒有分類,則是 default_category 配置信息。 |
您可在 permalink_defaults
參數(shù)下調(diào)整永久鏈接中各變量的默認(rèn)值:
permalink_defaults:
lang: en
假設(shè) source/_posts
文件夾中有個(gè) hello-world.md
,包含以下內(nèi)容:
title: Hello World
date: 2013-07-14 17:01:34
categories:
- foo
- bar
參數(shù) | 結(jié)果 |
---|---|
:year/:month/:day/:title/ |
2013/07/14/hello-world |
:year-:month-:day-:title.html |
2013-07-14-hello-world.html |
:category/:title |
foo/bar/hello-world |
若要建立一個(gè)多語(yǔ)種的網(wǎng)站,您可修改 new_post_name
和 permalink
參數(shù),如下:
new_post_name: :lang/:title.md
permalink: :lang/:title/
當(dāng)您建立新文章時(shí),文章會(huì)被儲(chǔ)存到:
$ hexo new "Hello World" --lang tw
# => source/_posts/tw/Hello-World.md
而網(wǎng)址會(huì)是:
http://localhost:4000/tw/hello-world/