mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-23 23:46:41 +00:00
website: fix broken GitHub links for project files in docs
This commit is contained in:
1 parent
56040adf28
commit
a85b958e1d
1 file changed
+3
-4
@@ -440,10 +440,9 @@ module.exports = function (ty) {
|
||||
if (fs.existsSync(linkFile)) {
|
||||
// this condition works if the link is a valid project file
|
||||
const githubUrl = "https://github.com/simplex-chat/simplex-chat/blob/stable"
|
||||
const keyword = "/simplex-chat"
|
||||
index = linkFile.indexOf(keyword)
|
||||
linkFile = linkFile.substring(index + keyword.length)
|
||||
parsed.path = `${githubUrl}${linkFile}`
|
||||
const repoRoot = hostFile.slice(0, hostFile.indexOf('/website/src'))
|
||||
const repoPath = linkFile.slice(repoRoot.length)
|
||||
return `${githubUrl}${repoPath}`
|
||||
} else {
|
||||
// if the link is not a valid website file or project file
|
||||
throw new Error(`Broken link: ${parsed.path} in ${hostFile}`)
|
||||
|
||||
Reference in new issue
Block a user