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
Copy file name to clipboardExpand all lines: packages/docs/docs/guide/markdown.md
+14-17
Original file line number
Diff line number
Diff line change
@@ -8,20 +8,7 @@ Headers automatically get anchor links applied. Rendering of anchors can be conf
8
8
9
9
### Internal Links
10
10
11
-
Inbound links ending in `.md` or `.html` are converted to `<router-link>` for SPA navigation.
12
-
13
-
Each sub-directory in your static site should contain a `README.md`. It will automatically be converted to `index.html`.
14
-
15
-
::: tip
16
-
When writing the relative path to a directory's `index.html`, don't forget to close it off with a `/`, otherwise you will get a 404. For example, use `/config/` instead of `/config`.
17
-
:::
18
-
19
-
If you want to link to another markdown file within a directory, remember to:
20
-
21
-
1. Append it with either `.html` or `.md`
22
-
2. Make sure the case matches since the path is case-sensitive
23
-
24
-
#### Example
11
+
Internal links are converted to `<router-link>` for SPA navigation. Also, every `README.md` or `index.md` contained in each sub-directory will automatically be converted to `index.html`, with corresponding url `/`.
25
12
26
13
Given the following directory structure:
27
14
@@ -38,14 +25,24 @@ Given the following directory structure:
38
25
└─ four.md
39
26
```
40
27
28
+
And providing you are in `foo/one.md`:
29
+
41
30
```md
42
31
[Home](/) <!-- Sends the user to the root README.md -->
43
32
[foo](/foo/) <!-- Sends the user to index.html of directory foo -->
44
-
[foo heading anchor](/foo/#heading) <!-- Anchors user to a heading in the foo README file -->
45
-
[foo - one](/foo/one.html) <!-- You can append .html -->
46
-
[foo - two](/foo/two.md) <!-- Or you can append .md -->
33
+
[foo heading](./#heading) <!-- Anchors user to a heading in the foo README file -->
34
+
[bar - three](../bar/three.md) <!-- You can append .md (recommended) -->
35
+
[bar - four](../bar/four.html) <!-- Or you can append .html -->
47
36
```
48
37
38
+
### Redirection for URLs <Badgetext="1.0.0-alpha.37"/>
39
+
40
+
VuePress supports redirecting to clean links. If a link `/foo` is not found, VuePress will look for a existing `/foo/` or `/foo.html`. Conversely, when one of `/foo/` or `/foo.html` is not found, VuePress will also try the other. With this feature, we can customize your website's urls with the official plugin [@vuepress/plugin-clean-urls](../plugin/official/plugin-clean-urls.md).
41
+
42
+
::: tip
43
+
Regardless of whether the permalink and clean-urls plugins are used, your relative path should be defined by the current file structure. In the above example, even though you set the path of `/foo/one.md` to `/foo/one/`, you should still access `/foo/two.md` via `./two.md`.
0 commit comments