Skip to content

Conversation

@osteele
Copy link
Owner

@osteele osteele commented Nov 22, 2025

Summary

Implements the jekyll-readme-index plugin (#29), which automatically redirects README files to serve as directory index pages.

What It Does

The plugin transforms README files (e.g., README.md, README.markdown) into directory index pages by remapping their URLs:

  • /README.html/
  • /foo/README.html/foo/
  • /foo/bar/README.html/foo/bar/

This matches Jekyll's jekyll-readme-index plugin behavior, making it easier to use README files as the main landing page for directories.

Implementation Details

  • Plugin Registration: Registered as jekyll-readme-index in the plugin system
  • PostReadSite Hook: Processes all pages after site reading is complete
  • Case-Insensitive: Detects README files regardless of case (README.md, readme.md, etc.)
  • Extension-Agnostic: Works with any markdown extension (.md, .markdown, .mdown)
  • URL Remapping: Uses the existing Site.RemapRoute() API to update routing

Testing

Added comprehensive test coverage:

  • TestIsReadmePage: Validates README file detection (root, nested, case-insensitive)
  • TestCalculateIndexURL: Validates URL transformation logic
  • Mock page implementation for isolated testing

Files Changed

  • plugins/readme_index.go: Plugin implementation (59 lines)
  • plugins/readme_index_test.go: Test suite (77 lines)

🤖 Generated with Claude Code

@osteele osteele force-pushed the claude/implement-issue-29-01WGg7xMiEAnJtX2ysqhLFRY branch 2 times, most recently from 178bd15 to 48e184c Compare November 22, 2025 16:23
- Implement a new `jekyll-readme-index` plugin.
- This plugin intercepts `README` files during page initialization.
- It calculates a new URL for `README` pages, mapping them to their parent directory's index URL (e.g., `/README.html` becomes `/`, and `/foo/README.html` becomes `/foo/`).
- The URL remapping is achieved by setting the `permalink` field in the page's front matter.
- This approach leverages Jekyll's standard way of handling permalinks.
- The plugin includes helper functions `isReadmePage` and `calculateIndexURL` for logic.
- Thorough unit tests are provided for both the helper functions and the plugin's `PostInitPage` hook.
@osteele osteele force-pushed the claude/implement-issue-29-01WGg7xMiEAnJtX2ysqhLFRY branch from 48e184c to eafdeaf Compare November 22, 2025 16:26
@osteele osteele merged commit ce16b94 into main Nov 29, 2025
4 checks passed
@osteele osteele deleted the claude/implement-issue-29-01WGg7xMiEAnJtX2ysqhLFRY branch November 29, 2025 11:26
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.

3 participants