Skip to content

Commit 5a12d6f

Browse files
devalogkgowru
andauthored
Improve code block readability in redirects page (Docs) (#452)
Co-authored-by: Kapil Gowru <[email protected]>
1 parent a8bc76a commit 5a12d6f

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

fern/products/docs/pages/seo/redirects.mdx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,31 @@ subtitle: Set up the navigation for your documentation site built with Fern Docs
55

66
## Redirects
77

8-
The `redirects` object allows you to redirect traffic from one path to another. You can also use [`regex`](https://www.npmjs.com/package/path-to-regexp) within redirects.
8+
The `redirects` object allows you to redirect traffic from one path to another. You can redirect exact paths or use dynamic patterns with [`regex`](https://www.npmjs.com/package/path-to-regexp) parameters like `:slug`.
99

10-
<Tabs>
11-
<Tab title="Redirect exact paths">
12-
```yml title="docs.yml"
10+
11+
<CodeBlock title="docs.yml">
12+
```yml
1313
redirects:
14+
# Exact path redirects
1415
- source: "/old-path"
1516
destination: "/new-path"
16-
- source: "/incorrect/path"
17-
destination: "/correct/path"
18-
```
19-
</Tab>
20-
21-
<Tab title="Redirect with regex">
22-
```yml title="docs.yml"
17+
- source: "/old-folder/path"
18+
destination: "/new-folder/path"
19+
20+
# Regex-based redirects
2321
- source: "/old-folder/:slug" # <- /old-folder/foo, /old-folder/bar, etc.
2422
destination: "/new-folder/:slug"
25-
- source: "/incorrect/:slug*" # <- /incorrect, /incorrect/foo/bar/baz, etc.
26-
destination: "/correct/:slug*"
23+
- source: "/old-folder/:slug*" # <- /incorrect, /incorrect/foo/bar/baz, etc.
24+
destination: "/new-folder/:slug*"
2725
```
26+
</CodeBlock>
27+
28+
<Info>
29+
Parameters suffixed with an asterisk (`*`) denote a match with zero or more.
30+
</Info>
2831

29-
<Info>
30-
Parameters suffixed with an asterisk (`*`) denote a match with zero or more.
31-
</Info>
32-
</Tab>
33-
</Tabs>
32+
### Setting permanent redirects
3433

3534
By default, the redirects implement temporary (302) redirects. If you would like to implement permanent (301) redirects, you can set `permanent: true`.
3635

0 commit comments

Comments
 (0)