File Structure
How to organize your documentation files
File Structure
OI Laravel Documentation uses a hierarchical file-based structure that automatically generates navigation. Understanding this structure is key to organizing your documentation effectively.
Directory Layout
Your documentation lives in resources/markdown/docs/ (configurable) and follows this pattern:
resources/markdown/docs/
βββ meta.json # Root metadata
βββ getting-started/
β βββ meta.json # Section metadata
β βββ _index.md # Section homepage
β βββ installation.md
β βββ configuration.md
βββ configuration/
β βββ meta.json
β βββ _index.md
β βββ basic-setup.md
β βββ advanced-options.md
βββ guides/
β βββ meta.json
β βββ _index.md
β βββ common-tasks/
β β βββ meta.json # Subsection metadata
β β βββ _index.md
β β βββ working-with-data.md
β βββ troubleshooting/
β βββ meta.json
β βββ _index.md
β βββ common-issues.md
βββ api-reference/
βββ meta.json
βββ _index.md
βββ endpoints.md
Required Files
Root meta.json
The root docs/meta.json defines your documentation package:
{
"type": "package",
"name": "my-package-name",
"title": "Documentation Title",
"description": "Short description",
"version": "1.0.0"
}Fields:
type- Always"package"(used for package imports)name- Package identifier (vendor/package format recommended)title- Display namedescription- Short summaryversion- Documentation version (optional)
This file is not shown in navigation but provides metadata for the entire documentation set.
Section meta.json
Each section folder requires a meta.json:
{
"type": "section",
"title": "Getting Started",
"description": "Installation and setup guide",
"order": 1
}Fields:
type- Always"section"title- Section display namedescription- Section description (shown in navigation)order- Sort order (lower numbers appear first)
Without meta.json, a section is skipped with a warning in console output.
The _index.md Pattern
The _index.md file in each section serves as the section's homepage:
getting-started/
βββ meta.json
βββ _index.md # This is the section homepage
βββ installation.md
βββ configuration.md
When you navigate to /documentation/getting-started, you're viewing _index.md.
The URL structure follows folder nesting:
getting-started/_index.mdβ/documentation/getting-startedguides/common-tasks/_index.mdβ/documentation/guides/common-tasksgetting-started/installation.mdβ/documentation/getting-started/installation
Nested Sections
You can nest sections to any depth. Each level requires its own meta.json:
guides/
βββ meta.json # Section
βββ _index.md
βββ common-tasks/
β βββ meta.json # Subsection
β βββ _index.md
β βββ working-with-data.md
βββ advanced/
β βββ meta.json
β βββ _index.md
β βββ caching/
β β βββ meta.json # Sub-subsection
β β βββ _index.md
β β βββ strategies.md
β βββ optimization.md
βββ troubleshooting/
βββ meta.json
βββ _index.md
βββ common-issues.md
This creates a navigation tree:
- Guides
- Common Tasks
- Working with Data
- Advanced
- Caching
- Strategies
- Optimization
- Caching
- Troubleshooting
- Common Issues
- Common Tasks
Naming Conventions
File Naming
Use lowercase filenames with hyphens:
β getting-started.md
β installation-steps.md
β GettingStarted.md
β Installation_Steps.md
Section Naming
Section folder names match the URL path and should be descriptive:
β getting-started/
β configuration/
β api-reference/
β getting-started-guide/ (Too verbose)
β config/ (Too ambiguous)
Ordering Files
Use numerical prefixes for strict ordering (optional):
01-installation.md
02-configuration.md
03-usage.md
Or specify order in frontmatter:
---
title: Installation
order: 1
---Both methods workβuse whichever you prefer.
Auto-Generation Files
The package automatically generates two JSON files. Never edit these manuallyβthey're regenerated by commands:
navigation.json
Auto-generated by doc:gen-nav:
{
"sections": [
{
"title": "Getting Started",
"slug": "getting-started",
"description": "Installation and setup",
"order": 1,
"pages": [
{
"title": "Introduction",
"slug": "getting-started",
"url": "/documentation/getting-started"
},
{
"title": "Installation",
"slug": "installation",
"url": "/documentation/getting-started/installation"
}
]
}
]
}search-index.json
Auto-generated by doc:gen-index:
{
"documents": [
{
"id": "getting-started",
"title": "Getting Started",
"section": "Getting Started",
"description": "Installation and setup",
"url": "/documentation/getting-started",
"content": "...",
"headings": ["Installation", "Configuration"],
"score": 0
}
]
}Organizing Large Documentation
By Feature
Organize documentation around features:
features/
βββ authentication/
βββ authorization/
βββ payments/
βββ notifications/
By Audience
Organize for different users:
docs/
βββ user-guide/
βββ developer-guide/
βββ api-reference/
βββ admin-manual/
By Topic
Group related topics:
docs/
βββ getting-started/
βββ core-concepts/
βββ tutorials/
βββ how-to-guides/
βββ reference/
βββ troubleshooting/
Regenerating Navigation
After adding, removing, or renaming files or folders, regenerate navigation:
php artisan doc:gen-navAfter content changes, regenerate search index:
php artisan doc:gen-indexOr both:
php artisan doc:gen-nav && php artisan doc:gen-indexBest Practices
- Always include meta.json in sections - Prevents warnings and ensures proper ordering
- Use _index.md for section homes - Makes section landing pages consistent
- Keep folder depth reasonable - Maximum 3-4 levels is typical
- Use descriptive names - File names should indicate content
- Group related pages - Keep similar topics in the same section
- Regenerate after changes - Always run generation commands after file changes
- Test navigation - Visit your docs to ensure structure is correct
Common Mistakes
Missing meta.json in a section:
β Section "guides" has no meta.json and will be skipped
Using capital letters in folder names:
β GettingStarted/ β URL becomes /documentation/GettingStarted
β getting-started/ β URL becomes /documentation/getting-started
Not regenerating navigation:
New files appear in filesystem but not in navigation menu.
Solution: Run `php artisan doc:gen-nav`
Forgetting _index.md:
Section exists but has no homepage. Create docs/section/_index.md.