We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 903c5d2 commit 9fcc137Copy full SHA for 9fcc137
src/pages/_utils-node.ts
@@ -48,10 +48,10 @@ export const rewriteRelativeLink = (url: string): string => {
48
let updatedUrl: string = url;
49
50
if (/^(https?:|mailto:|\/\/)/.exec(url)) {
51
- // Leave external URLs alone
+ // Skip rewriting for external URLs (http(s), mailto)
52
return url;
53
- } else if (url.startsWith('#')) {
54
- // Leave links to headings alone
+ } else if (url.startsWith('#')||url.startsWith('/')) {
+ // Skip rewriting for heading links and root-relative internal paths
55
updatedUrl = url;
56
} else {
57
// Convert relative paths to '../' (because pages that started as files in the same directory
0 commit comments