Skip to content

Commit 90ab826

Browse files
committed
More URL tweaks
1 parent 5dc0cf9 commit 90ab826

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Welcome"
33
id: "index"
44
description: 'Get Started with Silk.NET'
5-
slug: '/docs'
5+
slug: '/'
66
---
77

88
import DocCardList from '@theme/DocCardList';

sources/Website/docusaurus.config.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,24 @@ const rewriteSourceLinks = (options) => {
2323
if (isAbsolute(node.url)) {
2424
return;
2525
}
26+
let url = node.url;
27+
let hashtag = url.indexOf('#');
28+
if (hashtag !== -1) {
29+
url = url.substring(0, hashtag);
30+
}
2631
let resolvedUrlPath = path.join(fileDirPath, node.url);
27-
console.log(resolvedUrlPath + " - " + node.url + " - " + fileDirPath);
28-
if (!path.relative(resolvedUrlPath, docsRoot).startsWith("..")) {
32+
if (!path.relative(docsRoot, resolvedUrlPath).startsWith("..")) {
2933
return;
3034
}
31-
let silk2Rel = path.relative(resolvedUrlPath, silk2Src);
35+
console.log(resolvedUrlPath + " - " + node.url + " - " + fileDirPath + " - " + path.relative(docsRoot, resolvedUrlPath));
36+
let silk2Rel = path.relative(silk2Src, resolvedUrlPath);
3237
if (!silk2Rel.startsWith("..")) {
38+
console.log(`replaced ${silk2Rel}`);
3339
node.url = `https://github.com/dotnet/Silk.NET/blob/main/src/${silk2Rel}`
3440
}
35-
let silk3Rel = path.relative(resolvedUrlPath, repoRoot);
41+
let silk3Rel = path.relative(repoRoot, resolvedUrlPath);
3642
if (!silk3Rel.startsWith("..")) {
43+
console.log(`replaced ${silk3Rel}`);
3744
node.url = `https://github.com/dotnet/Silk.NET/blob/develop/3.0/${silk3Rel}`
3845
}
3946
});

0 commit comments

Comments
 (0)