提交 39843590 编写于 作者: U ULIVZ

docs: permalinks

上级 f2c3a636
......@@ -2,7 +2,7 @@
sidebar: auto
---
# Themes
# Theme
## Background
......@@ -35,6 +35,48 @@ However, for a blog system, we hope that the link of a post can be customized. V
It seems that we have seen the shadow of the blog. Let's continue to look down.
## Permalinks
A permalink is a URL that is intended to remain unchanged for many years into the future, yielding a hyperlink that is less susceptible to link rot<sup>[1]</sup>. VuePress supports a flexible way to build permalinks, allowing you to leverage various template variables.
The default permalink is `/:regular`.
### Configure Permalinks
You can configure globally to apply it for all pages:
```js
// .vuepress/config.js
module.exports = {
permalink: '/:year/:month/:day/:slug'
}
```
Alternatively, you can also set permalink on a page only, and it will have a higher priority than the global settings.
📝 __hello.md__:
```markdown
---
title: Hello World
permalink: /hello-world
---
Hello!
```
### Template Variables
| Variable | Description |
|---|---|
|:year|Published year of posts (4-digit)|
|:month|Published month of posts (2-digit)|
|:i_month|Published month of posts (Without leading zeros)|
|:day|Published day of posts (2-digit)|
|:i_day|Published day of posts (Without leading zeros)|
|:slug|Slugified file path (Without extension)|
|:regular| Permalink generated by VuePress by default, for implementation see [here](https://github.com/vuejs/vuepress/blob/next/packages/%40vuepress/shared-utils/lib/fileToPath.js) |
## Writing a theme
TODO. integrate with the old docs.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册