Skip to content

fix(collector): root README.md is the home page, not a broken /. slug - #34

Merged
losolio merged 1 commit into
mainfrom
fix/root-readme-home
Jul 25, 2026
Merged

fix(collector): root README.md is the home page, not a broken /. slug#34
losolio merged 1 commit into
mainfrom
fix/root-readme-home

Conversation

@losolio

@losolio losolio commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Asked: should a repo's top-level README.md be the home page? Yes — and today
it isn't.

buildTargetPath renamed every README.md to <parent-dir>.md. For a root
README that parent dir is ., producing .md → the broken slug /. we saw in
the zero-config **/*.md run. A README at the collection root now maps to
index.md (slug = target, e.g. /) — which is exactly what the function's own
comment already promised ("README.md becomes index.md so it acts as a directory
index page"). Nested READMEs (libs/*/README.md → /libraries/<lib>) are
unchanged.

So npx lectio-docs dev in a repo with a root README now shows it as the home
page.

Verified

Root README.md + **/*.md → slug /, and its content renders at
dist/index.html. Nested guides/setup.md/guides/setup as before.

…slug

buildTargetPath renamed every README.md to `<parent-dir>.md`, which for a
top-level README produced `.md` → slug `/.`. A README at the collection root now
maps to index.md (slug = target, e.g. `/`), matching the function's own stated
intent and making a repo's README the natural home in the zero-config `**/*.md`
setup. Nested READMEs are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 25, 2026 19:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

The updated README behavior is correct, but the surrounding documentation/comments in collect.ts are now inconsistent with the implemented logic and should be aligned.

Pull request overview

This PR fixes slug generation for a repo’s top-level README.md so it becomes the documentation home page (/) rather than producing a broken /. slug when collecting via a broad glob like **/*.md.

Changes:

  • Update buildTargetPath to map a collection-root README.md to index.md (home page) while keeping nested README behavior the same.
  • Add a changeset documenting the patch behavior change for @eventuras/lectio-docs.
File summaries
File Description
packages/lectio-docs/src/collector/collect.ts Special-cases a root README.md to become index.md, preventing /. slugs and making the root README the home page.
.changeset/root-readme-home.md Documents the patch release behavior change for root README handling.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Low

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +111 to +114
// README.md is renamed so it acts as an index page. A README at the
// collection root is the site's home (index.md → the target itself, e.g. "/");
// a nested one is named after its parent directory, so
// libs/event-sdk/README.md → /libraries/event-sdk.
@losolio
losolio merged commit f606a78 into main Jul 25, 2026
2 checks passed
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