diff --git a/Source/SuperOffice.DocsNext/ClientApp/src/pages/about.astro b/Source/SuperOffice.DocsNext/ClientApp/src/pages/about.astro new file mode 100644 index 00000000..64812722 --- /dev/null +++ b/Source/SuperOffice.DocsNext/ClientApp/src/pages/about.astro @@ -0,0 +1,19 @@ +--- +import { getEntry } from "astro:content"; +import { render } from "astro:content"; +const aboutEntry = await getEntry("contribute", "about"); +const tocData = await getTocByPath('contribution'); +import { getTocByPath } from "@utils/tocUtils"; +import ContentLayout from "@layouts/ContentLayout.astro"; + +const { Content, headings } = aboutEntry ? await render(aboutEntry) : { Content: undefined, headings: [] }; +--- + + + {Content && } + "/project/learn" */ export function stripFilePathAndExtension(filePath: string, collection: string): string { - const base = `${contentDir}/` - return filePath.replace(base, "").replace(`${collection}/`, "").replace(/\/index/g, "").replace(/\.(md|yml|yaml)$/g, "");; + // Assumes `contentDir` is a global string like "external-content" + const escapeRegExp = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + + // normalize backslashes -> forward slashes + let p = filePath.replace(/\\/g, "/"); + + // normalize base and collection (remove leading/trailing slashes) + const baseDir = contentDir.replace(/\\/g, "/").replace(/^\/+|\/+$/g, ""); + const col = collection.replace(/\\/g, "/").replace(/^\/+|\/+$/g, ""); + + // remove leading baseDir/ + if (baseDir) { + p = p.replace(new RegExp(`^${escapeRegExp(baseDir)}\/+`), ""); + } + + // remove leading collection/ + if (col) { + p = p.replace(new RegExp(`^${escapeRegExp(col)}\/+`), ""); + } + + // remove trailing /index.ext (subfolder index) OR leading index.ext (collection root) + p = p.replace(/\/index\.(md|ya?ml)$/i, ""); + p = p.replace(/^index\.(md|ya?ml)$/i, ""); + + // if still has an extension, strip it + p = p.replace(/\.(md|ya?ml)$/i, ""); + + // ensure leading slash; if empty -> root "/" + return p ? `/${p}` : "/"; } + /** * Removes a known file extension (.md, .mdx, .yml, .yaml, .html) from a path. * Logs a warning if an unknown or unsupported extension is detected. diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index 1a6bcd1b..40f8b2b0 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -30,7 +30,7 @@ stages: name: Default demands: # - agent.os -equals Linux - - Agent.ComputerName -equals tfs-build-23 + - Agent.ComputerName -equals TFS-VMUX-33 steps: # Checkout your main repo - checkout: self