feat(directory-tree): display readme.md files in directory menu by monotykamary · Pull Request #91 · dwarvesf/memo.d.foundation · GitHub
Skip to content

feat(directory-tree): display readme.md files in directory menu#91

Merged
monotykamary merged 1 commit into
mainfrom
feat/show-readme-in-directory-tree
Apr 2, 2025
Merged

feat(directory-tree): display readme.md files in directory menu#91
monotykamary merged 1 commit into
mainfrom
feat/show-readme-in-directory-tree

Conversation

@monotykamary

@monotykamary monotykamary commented Apr 2, 2025

Copy link
Copy Markdown
Collaborator

Description

This PR updates the directory tree menu to display readme.md files as separate menu items that link to their parent directory.

Changes

  1. Modified getAllMarkdownFiles in paths.ts to include readme.md files as separate entries in the path list with 'readme' slug.
  2. Updated the DirectoryTree component to:
    • Detect readme entries by checking if the path ends with '/readme'
    • Make readme entries link to their parent directory (e.g., '/consulting/readme' links to '/consulting')
    • Keep the frontmatter title/short_title for readme files instead of hardcoding a label

Before

Directory tree would only show:

/consulting
  /child

After

Directory tree now shows:

/consulting 
  /Consulting Overview (clicking redirects to /consulting)
  /child

Where "Consulting Overview" is the frontmatter title of the readme.md file.

Testing

  • Directories with readme.md files now show them as clickable items in the menu
  • Clicking on the readme item correctly navigates to the parent directory
  • The title shown in the menu uses the frontmatter from the readme.md file

@monotykamary

Copy link
Copy Markdown
Collaborator Author

@monotykamary monotykamary merged commit c117f5a into main Apr 2, 2025
@tieubao tieubao deleted the feat/show-readme-in-directory-tree branch April 3, 2025 06:57
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.

1 participant