Skip to content

Commit efffb2a

Browse files
bencodezenyyx990803
authored andcommitted
docs: clarify documentation on how to use links (#188)
1 parent 8f0755a commit efffb2a

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

β€Ždocs/guide/markdown.md

+48-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,55 @@ Headers automatically get anchor links applied. Rendering of anchors can be conf
1212

1313
## Links
1414

15-
- Inbound links ending in `.md` or `.html` are converted to `<router-link>` for SPA navigation.
15+
### Internal Links
1616

17-
- [Home](/)
18-
- [Configuring Markdown](../config/#markdown)
17+
Inbound links ending in `.md` or `.html` are converted to `<router-link>` for SPA navigation.
18+
19+
Each sub-directory in your static site should contain a `README.md`. It will automatically be converted to `index.html`.
20+
21+
::: tip
22+
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.
23+
24+
```md
25+
<!-- You'll get a 404 -->
26+
[About Page](/about)
27+
28+
<!-- This is correct -->
29+
[About Page](/about/)
30+
```
31+
:::
32+
33+
If you want to link to another markdown file within a directory, remember to:
34+
35+
1. Append it with either `.html` or `.md`
36+
2. Make sure the case matches since the path is case-sensitive
37+
38+
#### Example
39+
40+
Given the following directory structure:
41+
42+
```
43+
.
44+
β”œβ”€ README.md
45+
β”œβ”€ foo
46+
β”‚Β Β β”œβ”€ README.md
47+
β”‚ β”œβ”€ one.md
48+
β”‚ └─ two.md
49+
└─ bar
50+
β”œβ”€ README.md
51+
β”œβ”€ three.md
52+
└─ four.md
53+
```
54+
55+
```md
56+
[Home](/) <!-- Sends the user to the root README.md -->
57+
[foo](/foo/) <!-- Sends the user to index.html of directory foo -->
58+
[foo heading anchor](/foo/#heading) <!-- Anchors user to a heading in the foo README file -->
59+
[foo - one](/foo/one.html) <!-- You can append .html -->
60+
[foo - two](/foo/two.md) <!-- Or you can append .md -->
61+
```
62+
63+
### External Links
1964

2065
- Outbound links automatically gets `target="_blank"`:
2166

0 commit comments

Comments
Β (0)