Skip to content

Commit e2f89ff

Browse files
NetdocsCopilot
andcommitted
docs(redirects): document per-page redirect_from front matter
Add a section covering redirect_from/aliases front matter as the recommended way to preserve a moved page's old URLs, and explain the precedence between the three redirect sources. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9926b34 commit e2f89ff

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

docs-site/docs/plugins/redirects.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,33 @@ title: redirects
77
Emits tiny client-side redirect pages that forward old URLs to new destinations. Useful
88
for vanity links and for preserving inbound links after restructuring.
99

10+
Redirects can be declared in three ways, from most to least local:
11+
12+
1. **Per-page front matter** (`redirect_from`) — recommended for content that moved or was
13+
renamed, because the old URLs live next to the page and travel with it.
14+
2. **`redirect_maps`** — a small inline table in the config.
15+
3. **`redirect_files`** — one or more external JSON files for large bulk tables.
16+
17+
All three are merged. On a conflicting source, an explicitly configured `redirect_maps`/
18+
`redirect_files` entry wins over a per-page `redirect_from`.
19+
20+
## Per-page redirects (`redirect_from`)
21+
22+
List the old URLs a page replaces in its front matter under `redirect_from` (a single string
23+
or a list). Each becomes a redirect to that page's current URL — so when you rename or move
24+
the page later, its redirects move with it. `aliases` is accepted as a synonym.
25+
26+
```markdown
27+
---
28+
title: LS – How to turn on the alternator
29+
redirect_from:
30+
- blog/2018/ls--how-to-turn-on-the-alternator/
31+
- 2018/03/20/ls-how-to-turn-on-the-alternator/
32+
---
33+
```
34+
35+
No plugin options are required for this; just enable the `redirects` plugin.
36+
1037
## Options
1138

1239
| Option | Type | Default | Description |

0 commit comments

Comments
 (0)