Project Structure
Understanding how WharfDocs organizes files will help you create and maintain your documentation effectively.
#Directory Layout
wharfdocs/
├── docs/ # Your documentation files
│ ├── 1.getting-started/
│ │ ├── 1.introduction.md
│ │ ├── 2.installation.md
│ │ └── 3.project-structure.md
│ ├── 2.core-concepts/
│ │ └── 1.markdown-syntax.md
│ └── 3.advanced/
│ └── 1.customization.md
├── src/ # PHP source code
│ ├── DocumentationEngine.php
│ ├── MarkdownParser.php
│ ├── NavigationBuilder.php
│ └── SearchIndexer.php
├── templates/ # HTML templates
│ └── layout.php
├── assets/ # Static assets
│ └── css/
│ └── style.css
├── vendor/ # Composer dependencies
├── index.php # Entry point
├── config.php # Configuration
├── composer.json # PHP dependencies
└── .htaccess # Apache rewrite rules
#Documentation Files
#File Naming Convention
Files and directories in the docs/ folder follow a specific naming pattern:
- Numeric Prefix: Controls the order (e.g.,
1.getting-started,2.core-concepts) - Descriptive Name: The actual name displayed in navigation
- Extension: Always
.mdfor Markdown files
Example:
1.getting-started/
1.introduction.md
2.installation.md
3.project-structure.md
#Frontmatter
Each Markdown file can include frontmatter metadata:
---
title: Page Title
description: Page description for SEO
---
# Page Content Starts Here
#URL Structure
The file structure directly maps to URLs:
| File Path | URL |
|---|---|
docs/1.getting-started/1.introduction.md |
/getting-started/introduction |
docs/2.core-concepts/1.markdown-syntax.md |
/core-concepts/markdown-syntax |
docs/3.advanced/1.customization.md |
/advanced/customization |
Note: Numeric prefixes are automatically removed from URLs.
#Creating New Pages
To add a new documentation page:
- Create a new
.mdfile in the appropriate directory - Add frontmatter with title and description
- Write your content in Markdown
- The navigation will update automatically
Example:
# Create a new section
mkdir docs/4.api-reference
# Add a page
touch docs/4.api-reference/1.endpoints.md
#Best Practices
- Use Numeric Prefixes: They control the order in navigation
- Organize by Topic: Group related pages in directories
- Write Clear Titles: They appear in navigation and search results
- Include Descriptions: Helps with SEO and search
- Keep URLs Clean: Use lowercase and hyphens for readability