|
5 | 5 | title: Redirects | How we docs |
6 | 6 | --- |
7 | 7 |
|
8 | | -import { GlossaryTooltip } from "~/components"; |
| 8 | +import { Details, GitHubCode, GlossaryTooltip } from "~/components"; |
9 | 9 |
|
10 | 10 | As your content changes (and it will change), <GlossaryTooltip term="redirect">redirects</GlossaryTooltip> preserve continuity for your users and (friendly) bots. |
11 | 11 |
|
@@ -64,23 +64,29 @@ We have two automations in GitHub to help with redirects. |
64 | 64 |
|
65 | 65 | An infinite redirect is when two pages keep redirecting to each other, trapping users in an infitnite loop that will crash their browser. |
66 | 66 |
|
67 | | -Because that’s just a terrible experience, we explicitly check for that as part of our required `CI` GitHub action. |
| 67 | +Because that's just a terrible experience, we explicitly check for that as part of our [required `CI` GitHub action](https://github.com/cloudflare/cloudflare-docs/blob/production/.github/workflows/ci.yml#L62-L63). |
68 | 68 |
|
69 | | -{/* {{ CI step — use GitHub code }} */} |
| 69 | +We trigger this check _after_ we build our site. What it does it then call [`validate-redirects.ts`](https://github.com/cloudflare/cloudflare-docs/blob/production/bin/validate-redirects.ts), which fails on: |
70 | 70 |
|
71 | | -We trigger this check _after_ we build our site. What it does it then call this script. |
| 71 | +- Infinite redirects |
| 72 | +- Duplicate redirects |
| 73 | +- Redirect targets with anchor links in them |
72 | 74 |
|
73 | | -{/* {{ Infinite redirects — use GitHub code }} */} |
74 | | - |
75 | | -{/* Talk through details of the script. */} |
| 75 | +<Details header="validate-redirects.ts"> |
| 76 | + <GitHubCode |
| 77 | + repo="cloudflare/cloudflare-docs" |
| 78 | + file="bin/validate-redirects.ts" |
| 79 | + commit="f5339d91b62353eb1233a64b8ab00aaf8f40cdac" |
| 80 | + lang="ts" |
| 81 | + code={{ title: "validate-redirects.ts" }} |
| 82 | + /> |
| 83 | +</Details> |
76 | 84 |
|
77 | 85 | ### Potential redirects |
78 | 86 |
|
79 | | -Contributors often struggle to know when they should add redirects. We try to help them by adding a comment to any pull requests that modify or delete content file paths. |
80 | | - |
81 | | -{/* Insert picture of comment */} |
| 87 | +Contributors often struggle to know when they should add redirects. We try to help them by [adding a comment](https://github.com/cloudflare/cloudflare-docs/blob/production/.github/workflows/comment-changed-filenames.yml) to any pull requests that modify or delete content file paths. |
82 | 88 |
|
83 | | -{/* Talk through script */} |
| 89 | + |
84 | 90 |
|
85 | 91 | --- |
86 | 92 |
|
|
0 commit comments