Skip to content

feat: fix wrong path prefixes when using multiple docsDirs - #67

Closed
puehringer wants to merge 1 commit into
rachfop:mainfrom
datavisyn:mp/docs_dirs_fix
Closed

feat: fix wrong path prefixes when using multiple docsDirs#67
puehringer wants to merge 1 commit into
rachfop:mainfrom
datavisyn:mp/docs_dirs_fix

Conversation

@puehringer

Copy link
Copy Markdown
Contributor

Summary

Fixes multiple bugs where docsDir configured as an array of sections only worked correctly for the first section. Root cause: the plugin collapsed multi-section config down to a single docsDir string internally and reused it everywhere instead of resolving each file's own section.

  • Wrong URLs for non-first sections - when a section's filesystem path differs from its routeBasePath, only the first section had its path correctly stripped from generated URLs; every other section leaked its raw directory into the output.
  • Same-named files across sections collided - a file with the same name in two sections could resolve to the same route, silently dropping one file's link/output in favor of a -2 suffixed duplicate in the wrong section.
  • Blog routeBasePath was hardcoded - the plugin assumed the blog always lives at blog, breaking output when presets.blog.routeBasePath is customized. Added blogDir/blogRouteBasePath options (defaulting to the previous behavior) to make this configurable.

Testing

Added regression tests covering all three scenarios; verified they fail on the pre-fix code and pass after. Existing test suites still pass - no behavior change for single-section (string docsDir) configs.

rachfop added a commit that referenced this pull request Sep 1, 2026
)

Each file now resolves its own docsDir section for URL prefixing,
route matching, and output paths, instead of reusing the first
section's path everywhere. Same-named files across sections no
longer collide on the same route. blogDir/blogRouteBasePath options
replace the hardcoded 'blog' routeBasePath (defaults unchanged).

Co-authored-by: Michael Pühringer <puehringer@users.noreply.github.com>
rachfop added a commit that referenced this pull request Sep 1, 2026
Several 0.5.x bugs (#63, #64/#68, #67, #69) shipped because no CI
ever ran against PRs. This runs the full unit + integration suites
on Node 18/20/22 for every pull request and push to main.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@rachfop

rachfop commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Merged onto main in 7e29899 (squash, conflict resolution against #61/#62/#63 done on my side — README section retargeted into docs/configuration.md). Your multi-docsDir fixes are live: per-section URL prefixing, per-section route scoping (no more same-name collisions), and the blogDir/blogRouteBasePath options. Thank you — solid diagnosis of the first-section collapse.

@rachfop

rachfop commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Merged as 7e29899 (squash-merged onto main with attribution to @puehringer) — the fork declined maintainer pushes, so the branch's content was landed manually after resolving conflicts with the recent README split and absolute-slug fixes. The per-file section resolution, section-scoped routes, and blogDir/blogRouteBasePath options are all live on main, covered by the test suite, and documented in docs/configuration.md. Thanks for the thorough fix!

@rachfop rachfop closed this Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants