Website: Update relative link modification in build-static-content script (#19887)
Closes: #19878 Changes: - Updated the regex that replaced spaces in relative links with dashes to also replace URL encoded space characters.
This commit is contained in:
+1
-1
@@ -281,7 +281,7 @@ module.exports = {
|
||||
throw new Error(`Could not build HTML partials from Markdown. A page (${pageRelSourcePath}) contains an invalid relative Markdown link (${hrefString.replace(/^href=/, '')}). To resolve, make sure all relative links on this page that link to a specific section include the Markdown page extension (.md) and try running this script again.`);
|
||||
}
|
||||
let referencedPageNewUrl = 'https://fleetdm.com/' + (
|
||||
(path.relative(topLvlRepoPath, referencedPageSourcePath).replace(/(^|\/)([^/]+)\.[^/]*$/, '$1$2').split(/\//).map((fileOrFolderName) => fileOrFolderName.toLowerCase().replace(/\s+/g, '-')).join('/'))
|
||||
(path.relative(topLvlRepoPath, referencedPageSourcePath).replace(/(^|\/)([^/]+)\.[^/]*$/, '$1$2').split(/\//).map((fileOrFolderName) => fileOrFolderName.toLowerCase().replace(/%20|\s+/g, '-')).join('/'))
|
||||
.split(/\//).map((fileOrFolderName) => encodeURIComponent(fileOrFolderName.replace(/^[0-9]+[\-]+/,''))).join('/')
|
||||
).replace(RX_README_FILENAME, '');
|
||||
if(possibleReferencedUrlHash) {
|
||||
|
||||
Reference in New Issue
Block a user