You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before 1.x.x, vuepress retrieves all markdown files in the documents source directory and defines the page links based on the file hierarchy. e.g. if you have the following file structure:
@@ -13,44 +14,36 @@ Before 1.x.x, vuepress retrieves all markdown files in the documents source dire
13
14
└── tags.md
14
15
```
15
16
16
-
Then you will get following available pages:
17
+
那么你就会获得以下的可用页面:
17
18
18
19
```
19
20
/source/
20
21
/source/tags.html
21
22
/source/_post/intro-vuepress.html
22
23
```
23
24
24
-
However, for a blog system, we hope that the link of a post can be customized. VuePress started supporting this feature from `1.0.0`. which is known as `permalink`. Then, the actual pages would be:
25
+
看起来我们已经发现了 blog 的阴暗面。让我们继续看下去。
25
26
26
-
```
27
-
/source/
28
-
/source/tags/
29
-
/source/2018/4/1/intro-vuepress.html
30
-
```
31
-
32
-
It seems that we have seen the shadow of the blog. Let's continue to look down.
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.
31
+
默认的永久链接是`/:regular`。
37
32
38
-
The default permalink is `/:regular`.
33
+
### 配置永久链接
39
34
40
-
### Configure Permalinks
41
-
42
-
You can configure globally to apply it for all pages:
35
+
你可以使用全局配置来向所有页面应用永久链接:
43
36
44
37
```js
45
38
// .vuepress/config.js
46
39
module.exports= {
47
-
permalink:'/:year/:month/:day/:slug'
48
-
}
40
+
permalink:"/:year/:month/:day/:slug"
41
+
};
49
42
```
50
43
51
-
Alternatively, you can also set permalink on a page only, and it will have a higher priority than the global settings.
44
+
另外,你也可以只为单独一个页面去设置永久链接。这种方式比全局配置拥有更高的优先级。
52
45
53
-
📝 __hello.md__:
46
+
📝 **hello.md**:
54
47
55
48
```markdown
56
49
---
@@ -61,14 +54,17 @@ permalink: /hello-world
61
54
Hello!
62
55
```
63
56
64
-
### Template Variables
65
-
66
-
| Variable | Description |
67
-
|---|---|
68
-
|:year|Published year of posts (4-digit)|
69
-
|:month|Published month of posts (2-digit)|
70
-
|:i_month|Published month of posts (Without leading zeros)|
71
-
|:day|Published day of posts (2-digit)|
72
-
|:i_day|Published day of posts (Without leading zeros)|
73
-
|:slug|Slugified file path (Without extension)|
74
-
|: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)|
0 commit comments