Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/root-readme-home.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@eventuras/lectio-docs": patch
---

A `README.md` at the collection root now becomes the home page (`/`) instead of
a broken `/.` slug — so a repo's top-level README is the natural landing page,
which is what the zero-config `**/*.md` setup wants. Nested READMEs are
unchanged (still named after their parent directory).
8 changes: 5 additions & 3 deletions packages/lectio-docs/src/collector/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ function buildTargetPath(file: string, source: DocSource, outputDir: string): st
const fileName = basename(file);
const fileDir = dirname(file);

// For glob patterns like "libs/*/README.md", use the parent directory name
// as the file name: libs/event-sdk/README.md → /libraries/event-sdk.md
// 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.
Comment on lines +111 to +114
if (fileName.toLowerCase() === 'readme.md') {
const parentDir = basename(fileDir);
const targetName = `${parentDir}.md`;
const targetName = parentDir === '.' ? 'index.md' : `${parentDir}.md`;
return join(outputDir, source.target, targetName);
}

Expand Down