Skip to content

fixes for 404 page #1019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scripts/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const bsToFs = (p) => p.replace(/\\/g, '/')
// Gets the folder depth of the specified path
const dirDepth = (myDir) => myDir.split(Path.sep).length

const returnEmbedContents = (match, p1, p2, p3, offset, string) => {
const returnEmbedContents = (match, p1, p2, p3, offset, string) => {
console.log("Found Embed: " + p1);
try {
embedContents = Fs.readFileSync('./docs/'+p1, { encoding: 'utf8' });
Expand All @@ -40,18 +40,18 @@ const renderTemplate = (template, vars, currentPageInfo) => {;
template = template.replace(new RegExp('{{\\s*' + key + '\\s*}}', 'gi'), value)
}


template = template.replace(new RegExp('(?<!code>){{embed\:([^"\']*?)}}', 'gi'),returnEmbedContents);

return template
}

// Gets the relative path to the source dir from a docs page
// Gets the relative path to the source dir from a docs page, returning a web-safe path
const getRelativeRootFromPage = (pagePath) => {
let depth = dirDepth(pagePath) - dirDepth(Path.resolve(CONFIG.sourceDir))
let relPath = ('..' + Path.sep).repeat(depth - 1)

return relPath
if (depth <= 1) return './';
let relPath = '../'.repeat(depth - 1);
return relPath.replace(/\/+$/, '') + '/';
}

// Returns a function that will slugify a heading and also handle future duplicate slugs when called again
Expand Down