fix(import): RM-17139 Ensure no /docs/docs slugs#23
Conversation
xavierandueza
left a comment
There was a problem hiding this comment.
Requesting changes: the slug normalization is collapsing terminal generic docs pages to the category slug in non-generic categories. That misses the main invariant and needs a small restructuring before merge.
| return extractUrlPathSegments(p.url) | ||
| } | ||
| const normalizedSegmentsFor = (p, categorySeg) => { | ||
| const rawSegments = categorySeg ? [categorySeg, ...segmentsFor(p)] : segmentsFor(p) |
There was a problem hiding this comment.
This combines the category segment with the URL segments before deciding whether a terminal generic docs route should fall back to introduction, which changes the invariant. A page at https://example.com/docs under a non-generic category currently becomes the category slug, not introduction:
const page = { title: 'Docs', url: 'https://example.com/docs' }
ensureUniqueSlugs([{ title: 'Guides', pages: [page] }]).get(page) // guidesThat means the fix only works when the organizer happens to put the entry page under a generic category. The cleaner model is to normalize the URL/virtual path first, turn an all-generic path into ['introduction'], and only then add the category as the outermost expansion segment for collision disambiguation. That keeps the base slug behavior deterministic (introduction) while still allowing guides-introduction if it genuinely collides.
There was a problem hiding this comment.
(agent response)
Fixed — normalized the page URL/virtual path before adding the category expansion segment, so terminal generic docs pages resolve to introduction under non-generic categories while collisions can still expand to guides-introduction. Added regression coverage. 36108cb
…' into fix/rm-17139-importer-docs-as-slug-for-docs-pages
/docs/docs slugs
🧰 Changes
docs.🧬 QA & Testing
node --test src/commands/import.slug-planner.test.jsnpm testnpm run step:skeleton https://www.mintlify.com/docs/docs/docs->/docs/getting-started-introductiondocs/index.mdand one fromdocs/api/index.md