@specglass/core 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -54,13 +54,16 @@ export function defineDocsCollection(options) {
|
|
|
54
54
|
export function getSlugFromFilePath(filePath) {
|
|
55
55
|
// Normalize path separators
|
|
56
56
|
let slug = filePath.replace(/\\/g, "/");
|
|
57
|
-
// Strip leading content/
|
|
57
|
+
// Strip leading content/ and/or docs/ prefixes.
|
|
58
|
+
// In monorepo context, entry.id is "content/docs/getting-started.mdx".
|
|
59
|
+
// When consumed via npm, the glob loader produces "docs/getting-started.mdx".
|
|
58
60
|
slug = slug.replace(/^content\//, "");
|
|
61
|
+
slug = slug.replace(/^docs\//, "");
|
|
59
62
|
// Strip file extension (.mdx or .md)
|
|
60
63
|
slug = slug.replace(/\.(mdx|md)$/, "");
|
|
61
64
|
// Handle index files — map to parent directory
|
|
62
65
|
slug = slug.replace(/\/index$/, "");
|
|
63
|
-
// Handle root index (just "index" after stripping
|
|
66
|
+
// Handle root index (just "index" after stripping prefixes)
|
|
64
67
|
if (slug === "index") {
|
|
65
68
|
return "";
|
|
66
69
|
}
|