- Add function to find first doc in sidebar - Pass found doc ID to process_page - Set slug: / for landing page in frontmatter
Docusaurus Link Resolution Test
This directory contains a comprehensive test for the herolib documentation linking mechanism.
Structure
for_testing/
├── README.md # This file
├── collections/
│ └── test_collection/ # Markdown source files
│ ├── .collection # Collection metadata
│ ├── page1.md # Introduction
│ ├── page2.md # Basic Concepts
│ ├── page3.md # Configuration
│ ├── page4.md # Advanced Features
│ ├── page5.md # Troubleshooting
│ ├── page6.md # Best Practices
│ └── page7.md # Conclusion
└── ebooks/
└── test_site/ # Heroscript configuration
├── heroscriptall # Master configuration (entry point)
├── config.heroscript # Site configuration
├── pages.heroscript # Page definitions
└── docusaurus.heroscript # Docusaurus settings
What This Tests
- Link Resolution - Each page contains links using the
[text](collection:page)format - Navigation Chain - Pages link sequentially: 1 → 2 → 3 → 4 → 5 → 6 → 7
- Sidebar Generation - All 7 pages should appear in the sidebar
- Category Support - Pages are organized into categories (root, basics, advanced, reference)
Running the Test
From the herolib root directory:
# Build herolib first
./cli/compile.vsh
# Run the test site
/Users/mahmoud/hero/bin/hero docs -d -p lib/web/docusaurus/for_testing/ebooks/test_site
Expected Results
When the test runs successfully:
- ✅ All 7 pages are generated in
~/hero/var/docusaurus/build/docs/ - ✅ Sidebar shows all pages organized by category
- ✅ Clicking navigation links works (page1 → page2 → ... → page7)
- ✅ No broken links or 404 errors
- ✅ Back-links also work (e.g., page7 → page1)
Link Syntax Being Tested
[Next Page](test_collection:page2)
This should resolve to a proper Docusaurus link when the site is built.
Verification
After running the test:
- Open http://localhost:3000/test/ in your browser
- Click through all navigation links from Page 1 to Page 7
- Verify the back-link on Page 7 returns to Page 1
- Check the sidebar displays all pages correctly
Troubleshooting
If links don't resolve:
- Check that the collection is registered in the atlas
- Verify page names match (no typos)
- Run with debug flag (
-d) to see detailed output - Check
~/hero/var/docusaurus/build/docs/for generated files