Skip to content

fix: treat INDEX.md and README.md as directory indices - #74

Merged
rachfop merged 1 commit into
rachfop:mainfrom
trofim24:main
Sep 17, 2026
Merged

rachfop merged 1 commit into
rachfop:mainfrom
trofim24:main

Conversation

@trofim24

Copy link
Copy Markdown
Contributor

Fixes #73.

Docusaurus routes a doc at its parent directory when the file name, lowercased, is "index", "readme", or the parent directory's name (isCategoryIndex in @docusaurus/plugin-content-docs). resolveDocumentUrl stripped only a lowercase "/index", so INDEX.md, Index.md and README.md failed to match their real route, fell back to the filename heuristic, and emitted URLs that 404.

Match Docusaurus in both the route-resolution tail and the no-route fallback. The endsWith('index') guard goes with it: the regex is anchored to the end of the path, so the guard was already redundant, and it would have blocked the readme case.

The third convention (/.md) was already handled correctly by collapseMatchingTrailingSegment, which compares lowercased — so this only brings the other two into line with it.

Docusaurus routes a doc at its parent directory when the file name,
lowercased, is "index", "readme", or the parent directory's name
(isCategoryIndex in @docusaurus/plugin-content-docs). resolveDocumentUrl
stripped only a lowercase "/index", so INDEX.md, Index.md and README.md
failed to match their real route, fell back to the filename heuristic,
and emitted URLs that 404.

Match Docusaurus in both the route-resolution tail and the no-route
fallback. The endsWith('index') guard goes with it: the regex is anchored
to the end of the path, so the guard was already redundant, and it would
have blocked the readme case.

The third convention (<folder>/<folder>.md) was already handled
correctly by collapseMatchingTrailingSegment, which compares lowercased —
so this only brings the other two into line with it.

@rachfop rachfop left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Thank you!

@rachfop
rachfop merged commit 501cf84 into rachfop:main Sep 17, 2026
rachfop added a commit that referenced this pull request Oct 2, 2026
Fix factual errors found by checking every documented claim against src/:

- Default llms.txt links have no .md suffix: addMdExtension applies only
  with generateMarkdownFiles.
- customLLMFiles[].includeUnmatchedLast defaults to true.
- Any .md/.mdx import is inlined, @alias/ paths resolve against the site
  directory, and a circular import is an error that drops the import.
- processingBatchSize sets progress-logging granularity; documents are
  all processed before batching, so it doesn't bound memory.
- pathTransformation addPaths inserts after the route base path; the
  examples now use site-relative paths with docsDir: 'docs'.
- Section headings need two or more sections and fall back to path;
  routeBasePath and blogRouteBasePath are relative to baseUrl.
- Root-URL pages map to index.md; sample log output matches the real
  output; remove the llmsTxtFilename "keep both links" example, which
  doesn't work.

Document behavior that had no docs: how titles and descriptions are
chosen (including the #76 skips), directory index handling (#74), the
llms-full.txt page structure, draft skipping, and the auto-mode
"Version: current" label.

Replace the duplicated DocsSection and CustomLLMFile tables in
content-generation.md with links to the configuration reference, merge
the two overlapping cleaning-combination sections, and drop text that
narrated history (the backward-compatibility section, "existing configs
are unaffected" caveats).

Give every page a front matter description and order the site's
llms.txt by the sidebar, so the dogfood llms.txt has full summaries in
reading order. Add a Documentation entry to the Unreleased changelog.

Co-authored-by: Claude Opus 5.5 <[email protected]>
rachfop added a commit that referenced this pull request Oct 2, 2026
Fix factual errors found by checking every documented claim against src/:

- Default llms.txt links have no .md suffix: addMdExtension applies only
  with generateMarkdownFiles.
- customLLMFiles[].includeUnmatchedLast defaults to true.
- Any .md/.mdx import is inlined, @alias/ paths resolve against the site
  directory, and a circular import is an error that drops the import.
- processingBatchSize sets progress-logging granularity; documents are
  all processed before batching, so it doesn't bound memory.
- pathTransformation addPaths inserts after the route base path; the
  examples now use site-relative paths with docsDir: 'docs'.
- Section headings need two or more sections and fall back to path;
  routeBasePath and blogRouteBasePath are relative to baseUrl.
- Root-URL pages map to index.md; sample log output matches the real
  output; remove the llmsTxtFilename "keep both links" example, which
  doesn't work.

Document behavior that had no docs: how titles and descriptions are
chosen (including the #76 skips), directory index handling (#74), the
llms-full.txt page structure, draft skipping, and the auto-mode
"Version: current" label.

Replace the duplicated DocsSection and CustomLLMFile tables in
content-generation.md with links to the configuration reference, merge
the two overlapping cleaning-combination sections, and drop text that
narrated history (the backward-compatibility section, "existing configs
are unaffected" caveats).

Give every page a front matter description and order the site's
llms.txt by the sidebar, so the dogfood llms.txt has full summaries in
reading order. Add a Documentation entry to the Unreleased changelog.
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.

INDEX.md / README.md are not recognised as directory indices, producing 404 links

2 participants