Repository navigation
fix: resolve page URLs and markdown paths the way Docusaurus routes them - #87
Merged
Merged
Conversation
- Docs files match routes under their section's routeBasePath first and
never match blog routes; blog files match blog routes only.
- Date-prefixed blog posts follow Docusaurus's YYYY/MM/DD route convention.
- A section-root index links its section's root route.
- Paths relative to the baseUrl always get it prepended, so a baseUrl equal
to the route base is kept in markdown and fallback links.
- Frontmatter slug and id resolve like Docusaurus getSlug: absolute slugs
join the route base, relative slugs and ids join the number-prefix-
stripped file directory, and index files ignore id. Markdown files for
route-resolved pages take their path from the route.
- A number-prefixed file named after its folder matches the stripped route.
- Links are percent-encoded per segment and markdown files are written
under decoded names.
- Files in _-prefixed directories are not listed as pages.
- A trailing {#id} is dropped from heading titles and duplicate detection.
- pathTransformation removes adjacent duplicate segments and adds no
trailing slash to an empty path.
…test The small-fixes test was written against the old blog URL (/blog/2024-01-01-post). With date-prefixed posts resolved like Docusaurus, the URL is /blog/2024/01/01/post.
rachfop
added a commit
that referenced
this pull request
Oct 2, 2026
…hem (#87) * fix: resolve page URLs and markdown paths the way Docusaurus routes them - Docs files match routes under their section's routeBasePath first and never match blog routes; blog files match blog routes only. - Date-prefixed blog posts follow Docusaurus's YYYY/MM/DD route convention. - A section-root index links its section's root route. - Paths relative to the baseUrl always get it prepended, so a baseUrl equal to the route base is kept in markdown and fallback links. - Frontmatter slug and id resolve like Docusaurus getSlug: absolute slugs join the route base, relative slugs and ids join the number-prefix- stripped file directory, and index files ignore id. Markdown files for route-resolved pages take their path from the route. - A number-prefixed file named after its folder matches the stripped route. - Links are percent-encoded per segment and markdown files are written under decoded names. - Files in _-prefixed directories are not listed as pages. - A trailing {#id} is dropped from heading titles and duplicate detection. - pathTransformation removes adjacent duplicate segments and adds no trailing slash to an empty path. * test: expect Docusaurus date paths for blog posts in the small-fixes test The small-fixes test was written against the old blog URL (/blog/2024-01-01-post). With date-prefixed posts resolved like Docusaurus, the URL is /blog/2024/01/01/post.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Page URLs and generated markdown paths could point at the wrong page or 404:
docs/about.mdresolved to/about). Docs files never match blog routes, and a single section prefers routes under itsrouteBasePath./blog/2024-01-01-hello; they now resolve to Docusaurus's/blog/2024/01/01/hello./blog/tags/docs).baseUrlequal to the first route segment (/docs/), generated.mdlinks dropped the baseUrl.idtook another page's URL, a nested absolute slug droppeddocs/from the.mdpath, and relative slugs failed under number-prefixed folders and on index files.02-api/02-api.mddidn't resolve to/docs/api..mdfiles were written with percent-encoded names on disk._-prefixed directories were listed as pages; Docusaurus excludes them.# Title {#id}) stayed in the title and made the heading appear twice.pathTransformation.ignorePathsmissed a repeated segment.tests/test-url-resolution.jscovers each case. Two existing expectations change to match Docusaurus: an absolute slug's.mdfile lands underdocs/, and link URLs are percent-encoded per segment. The docs site build output is unchanged. On a 3,461-page docs site, with and without its 6,728 real routes, the only difference is that pages underdocs/_includes/are no longer listed.