fix(collector): root README.md is the home page, not a broken /. slug - #34
Merged
Conversation
…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>
There was a problem hiding this comment.
⚠️ 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
buildTargetPathto map a collection-rootREADME.mdtoindex.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. |
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.
Asked: should a repo's top-level
README.mdbe the home page? Yes — and todayit isn't.
buildTargetPathrenamed everyREADME.mdto<parent-dir>.md. For a rootREADME that parent dir is
., producing.md→ the broken slug/.we saw inthe zero-config
**/*.mdrun. A README at the collection root now maps toindex.md(slug = target, e.g./) — which is exactly what the function's owncomment already promised ("README.md becomes index.md so it acts as a directory
index page"). Nested READMEs (
libs/*/README.md → /libraries/<lib>) areunchanged.
So
npx lectio-docs devin a repo with a root README now shows it as the homepage.
Verified
Root
README.md+**/*.md→ slug/, and its content renders atdist/index.html. Nestedguides/setup.md→/guides/setupas before.