fix(externalLinks): make external link warning work with subpaths

This commit is contained in:
Philip Molares
2026-07-22 20:14:44 +02:00
committed by GitHub
parent c77d64ad6e
commit 1a7c27470e
2 changed files with 3 additions and 1 deletions

View File

@@ -624,7 +624,8 @@ export function rewriteExternalLinks (view) {
return
}
const noteURL = window.location.pathname.split('/').pop()
anchor.attr('href', `${window.location.origin}/_link?url=${encodeURIComponent(parsed.href)}&note=${noteURL}`)
const urlPath = window.urlpath ? `/${window.urlpath}` : ''
anchor.attr('href', `${window.location.origin}${urlPath}/_link?url=${encodeURIComponent(parsed.href)}&note=${noteURL}`)
})
}
window.rewriteExternalLinks = rewriteExternalLinks