-
Notifications
You must be signed in to change notification settings - Fork 340
Expand file tree
/
Copy path404.html
More file actions
82 lines (76 loc) · 3.76 KB
/
Copy path404.html
File metadata and controls
82 lines (76 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Redirecting to communitynotes.x.com/guide</title>
<script>
// --- Start of Optimized Code ---
// All redirects are now consolidated in one place.
const redirectAliases = {
"/learn-more": "/",
"/intro": "/",
"/overview": "/",
"/additional-review": "/contributing/additional-review",
"/aliases": "/contributing/aliases",
"/challenges": "/about/challenges",
"/risks": "/about/challenges",
"/contributor-scores": "/under-the-hood/contributor-scores",
"/contributor-reputation": "/under-the-hood/contributor-scores",
"/diversity-of-perspectives": "/contributing/diversity-of-perspectives",
"/diversity": "/contributing/diversity-of-perspectives",
"/perspectives": "/contributing/diversity-of-perspectives",
"/data": "/under-the-hood/download-data",
"/about/data": "/under-the-hood/download-data",
"/download-data": "/under-the-hood/download-data",
"/note-examples": "/contributing/examples",
"/examples": "/contributing/examples",
"/tips": "/contributing/examples",
"/note-writing-tips": "/contributing/examples",
"/faq": "/about/faq",
"/submit-feedback": "/contributing/feedback",
"feedback": "/contributing/feedback", // Note: This might be an error, consider changing to "/feedback"
"/getting-started": "/contributing/getting-started",
"/guardrails": "/under-the-hood/guardrails",
"/note-ranking-code": "/under-the-hood/note-ranking-code",
"/ranking-code": "/under-the-hood/note-ranking-code",
"/code": "/under-the-hood/note-ranking-code",
"/notes-on-twitter": "/contributing/notes-on-twitter",
"/cards-on-twitter": "/contributing/notes-on-twitter",
"/notes-on-tweets": "/contributing/notes-on-twitter",
"/alerts": "/contributing/notifications",
"/ranking-notes": "/under-the-hood/ranking-notes",
"/note-ranking": "/under-the-hood/ranking-notes",
"/rating-notes": "/contributing/rating-notes",
"/rating": "/contributing/rating-notes",
"/join": "/contributing/sign-up",
"/signup": "/contributing/sign-up",
"/sign-up": "/contributing/sign-up",
"/signing-up": "/contributing/sign-up",
"/timeline-tabs": "/under-the-hood/timeline-tabs",
"/values": "/contributing/values",
"/writing-ability": "/contributing/writing-ability",
"/impact": "/contributing/writing-and-rating-impact",
"/birdwatch-scores": "/contributing/writing-and-rating-impact",
"/writing-and-rating-impact": "/contributing/writing-and-rating-impact",
"/rating-and-writing-impact": "/contributing/writing-and-rating-impact",
"/writing-notes": "/contributing/writing-notes",
"/writing-and-rating-notes": "/contributing/writing-notes",
};
// 1. Get the path and clean it up.
let requestedPath = window.location.pathname
.replace(/^\/communitynotes/, "") // Remove subdirectory
.replace(/\.html$/, "") // Remove .html extension
.toLowerCase(); // Make it case-insensitive
// 2. Remove trailing slash if it exists and isn't the root path.
if (requestedPath.length > 1 && requestedPath.endsWith('/')) {
requestedPath = requestedPath.slice(0, -1);
}
// 3. Find the new path. Use the original path if no alias is found.
const finalPath = redirectAliases[requestedPath] || requestedPath;
// 4. Perform the redirect.
window.location.replace("https://communitynotes.x.com/guide" + finalPath);
// --- End of Optimized Code ---
</script>
</head>
<body></body>
</html>