Skip to content

Commit e25361d

Browse files
committed
Include keyworld_linker script to all pages
1 parent 222d154 commit e25361d

4 files changed

Lines changed: 5 additions & 12 deletions

File tree

web/public/mta-keyword_linker.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,18 @@ const customLinks = new Map([
2020
function sanitizeUrl(url) {
2121
if (typeof url !== "string") return null;
2222

23-
// Allow root-relative URLs (e.g. "/reference/Vector3")
24-
if (url.startsWith("/")) {
23+
if (url.startsWith("/") && !url.startsWith("//")) {
2524
return url;
2625
}
2726

2827
try {
2928
const parsed = new URL(url, window.location.origin);
3029
const protocol = parsed.protocol.toLowerCase();
3130

32-
// Only allow http/https URLs
3331
if (protocol === "http:" || protocol === "https:") {
3432
return parsed.href;
3533
}
36-
} catch (e) {
37-
// If URL construction fails, treat as unsafe
38-
return null;
39-
}
34+
} catch (_) {}
4035

4136
return null;
4237
}

web/src/components/CodeExamplesSection.astro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,3 @@ if (codeExamples.length === 0 && !examplesRequired) {
129129
window.addEventListener('resize', checkOverflow);
130130
});
131131
</script>
132-
133-
<script type="module" src="/mta-keyword_linker.js"></script>

web/src/overrides/PageTitle.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,5 @@ document.addEventListener("DOMContentLoaded", () => {
146146
window.addEventListener("resize", adjustTitle);
147147
});
148148
</script>
149+
150+
<script type="module" src="/mta-keyword_linker.js"></script>

web/src/pages/reference/[theType].astro

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,4 @@ if (theType.data.redirect)
3232
}}>
3333

3434
<EnhancedMarkdown content={theType.data.description} />
35-
</StarlightPage>
36-
37-
<script type="module" src="/mta-keyword_linker.js"></script>
35+
</StarlightPage>

0 commit comments

Comments
 (0)