Skip to content

Commit 3b48e0e

Browse files
committed
Added scripts and links to redirects
1 parent 2acef48 commit 3b48e0e

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed
86.5 KB
Loading

src/content/docs/style-guide/how-we-docs/redirects.mdx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ meta:
55
title: Redirects | How we docs
66
---
77

8-
import { GlossaryTooltip } from "~/components";
8+
import { Details, GitHubCode, GlossaryTooltip } from "~/components";
99

1010
As your content changes (and it will change), <GlossaryTooltip term="redirect">redirects</GlossaryTooltip> preserve continuity for your users and (friendly) bots.
1111

@@ -64,23 +64,29 @@ We have two automations in GitHub to help with redirects.
6464

6565
An infinite redirect is when two pages keep redirecting to each other, trapping users in an infitnite loop that will crash their browser.
6666

67-
Because thats 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).
6868

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:
7070

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
7274

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>
7684

7785
### Potential redirects
7886

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.
8288

83-
{/* Talk through script */}
89+
![GitHub Actions redirect comment](~/assets/images/style-guide/how-we-docs/redirects-comment.png)
8490

8591
---
8692

0 commit comments

Comments
 (0)