Understanding Hugo Documentation
Understanding Hugo-Generated Documentation
This guide explains how the FileBrowser Quantum documentation is structured using Hugo and the custom theme.
Hugo Theme
The documentation uses a custom Hugo theme based on Lotus Docs, a modern documentation theme for Hugo. The theme provides:
Getting Help with Lotus Docs
For detailed theme documentation and advanced features, visit the Lotus Docs website. The official documentation includes:
- Configuration options - All available parameters
- Customization guides - Styling and theming
- Shortcode examples - How to use custom shortcodes
- Deployment guides - Platform-specific instructions
- Advanced features - Search, analytics, and more
Using Theme Features
Custom Shortcodes
Lotus Docs provides powerful shortcodes for enhanced content:
Alerts:
The theme supports multiple alert types with automatic icons:
This is an informational alert with automatic icon.
This is a warning alert with automatic icon.
This is a success alert with automatic icon.
This is a danger alert with automatic icon.
This is a primary alert with automatic icon.
This is a default alert with automatic icon.
Alert Types and Icons:
| Type | Icon | Use Case |
|---|---|---|
info | ℹ️ info | General information, tips, notes |
warning | ⚠️ warning | Important notices, cautions |
success | ✅ check_circle | Success messages, confirmations |
danger | ❌ report | Errors, critical issues, failures |
primary | ℹ️ info | Primary information, highlights |
default | 🔔 notifications | General notifications, updates |
Alert Customization:
You can customize alerts with custom icons and titles:
Custom Title: This alert uses a custom star icon instead of the default info icon.
Rich Content Alerts:
For detailed alerts with titles and multiple paragraphs:
Note: If you are using Docker, you need to mount a volume with the branding directory in order for it to be accessible from within the container.
This is a second paragraph in the same alert. You can include multiple lines of text, code examples, and even lists.
First item
Second item
Third item
Important: This is a warning with multiple sections.
The first paragraph explains the main issue.
The second paragraph provides additional context and details about what might happen if you don’t follow the instructions.
Code Example:
| |
Tabs:
Create interactive tabbed content for organizing related information:
Advanced Example with Right-Aligned Tab:
Code Highlighting:
The theme uses Hugo’s built-in Chroma syntax highlighting for code blocks. You can use fenced code blocks or the Hugo highlight shortcode:
Fenced Code Blocks (Recommended for simple highlighting):
Hugo Highlight Shortcode with Line Numbers:
Table of Contents
Enable TOC on any page by adding toc: true to the front matter.
Custom Icons
Use Material Symbols icons in front matter by adding icon: "icon_name".
Available icon categories:
- Navigation:
home,menu,arrow_back - Actions:
play_arrow,pause,stop - Content:
article,code,image - Communication:
chat,email,phone - And many more…
Math Equations
Use KaTeX for mathematical expressions. Important: You must add katex: true to your page’s front matter to enable KaTeX rendering.
Inline Math: Inline math: $E = mc^2$
Block Math: $$ \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi} $$
KaTeX Shortcode (for complex equations):
Mermaid Diagrams
Create diagrams with Mermaid using fenced code blocks:
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
Building Documentation
Using Makefile
The easiest way to build and serve the documentation locally:
Run make dev to:
- Start a local Hugo development server
- Enable live reloading when files change
- Serve the documentation at
http://localhost:1313
Manual Hugo Commands
If you prefer to use Hugo directly:
hugo server- Serve locally with live reloadhugo- Build static sitehugo --extended- Build with extended features
Documentation Structure
File Organization
The documentation follows a hierarchical structure:
_index.mdfiles serve as section homepages- Individual pages are organized in logical directories
- Subdirectories group related content
- Each section has its own
_index.mdfor navigation
Required Front Matter
Every documentation page must include front matter with these attributes:
title- Page title (required)description- Brief description (required)icon- Material icon name (required)date- Publication date (required)lastmod- Last modification date (required)
Optional Front Matter
These fields are optional but can enhance your documentation:
order- Manual ordering override within the same directory (optional, default: 0)draft- Mark page as draft to exclude from build (optional, default: false)toc- Enable/disable table of contents (optional, default: true)katex- Enable KaTeX math rendering (optional, default: false)
Required Attributes
Title
- Required: Yes
- Purpose: Page title displayed in navigation and browser tab
- Format: String, should be descriptive and concise
- Example:
"Docker Installation"
Description
- Required: Yes
- Purpose: Brief description used in navigation and search
- Format: String, 1-2 sentences
- Example:
"Install FileBrowser using Docker containers"
Icon
- Required: Yes
- Purpose: Material Design icon displayed in navigation
- Format: String, Material icon name
- Examples:
"rocket_launch"- Getting started"settings"- Configuration"api"- API reference"security"- Access control"help"- Help topics
Date
- Required: Yes
- Purpose: When the article was first published/created
- Format: ISO 8601 date string (RFC 3339)
- Examples:
"2024-01-15T10:00:00Z"- January 15, 2024 at 10:00 AM UTC"2024-03-20T14:30:00-05:00"- March 20, 2024 at 2:30 PM EST
- Usage: Used for sorting, RSS feeds, and showing publication date
- Note: This should remain constant - only change if you’re republishing an existing article
Last Modified (lastmod)
- Required: Yes
- Purpose: When the article was last updated/modified
- Format: ISO 8601 date string (RFC 3339)
- Examples:
"2024-10-08T18:30:00Z"- October 8, 2024 at 6:30 PM UTC"2024-12-01T09:15:00-08:00"- December 1, 2024 at 9:15 AM PST
- Usage: Used for showing “last updated” information, sitemaps, and cache invalidation
- Note: Update this every time you make changes to the content
Order
- Required: No (defaults to 0)
- Purpose: Manual override for page ordering within the same directory level
- Format: Integer (positive, zero, or negative)
- How It Works:
- Positive integers (1, 2, 3…): Pages appear first, second, third, etc. at their peer level
- Zero or unset: Pages use default alphabetical sorting by path
- Negative integers (-1, -2, -3…): Pages appear last, second to last, third to last, etc.
- Examples:
- Usage:
- Use when you need specific ordering within a folder
- Applies to sidebar navigation, list pages, and next/previous navigation
- Only affects pages at the same directory level (peers)
- Notes:
- The automatic ordering system still uses file paths as the primary sort
- The
orderfield only overrides ordering within the same directory - If multiple pages have the same order value, they’re sorted alphabetically by path
- Works seamlessly with the automatic ordering system (
autoOrdering = trueinhugo.toml)
Draft
- Required: No (defaults to false)
- Purpose: Controls whether the page is published
- Format: Boolean (true/false)
- Usage: Set to
truewhile working on content,falsewhen ready to publish - Note: Draft pages are not included in the built site
Extended Hugo Version
The documentation requires Hugo Extended version because:
- SCSS/SASS Support - The theme uses SCSS for styling
- Advanced Features - Extended version includes additional processing capabilities
- Theme Compatibility - The custom theme requires extended features
Checking Your Hugo Version
Run hugo version and look for extended in the output:
| |
Installing Hugo Extended
macOS (Homebrew): brew install hugo
Windows (Chocolatey): choco install hugo-extended
Linux: Download from GitHub releases and install the extended version
Docker: docker run --rm -it -v $(pwd):/src -p 1313:1313 klakegg/hugo:extended server
Common Issues
Build Failures
If you encounter build issues:
- Check Hugo Version: Ensure you have Hugo Extended
- Theme Issues: The theme might need updates
- Dependencies: Missing Hugo modules
Getting Help
If you’re unable to build the documentation:
- Check Requirements: Ensure Hugo Extended is installed
- Update Dependencies: Run
hugo mod get -u - Open an Issue: Create an issue on the repository with:
- Your Hugo version (
hugo version) - Operating system
- Error messages
- Steps to reproduce
- Your Hugo version (
Theme Issues
The documentation uses a custom theme. If you encounter theme-related issues:
- Theme Updates: The theme might need updates
- Compatibility: Check Hugo version compatibility
- Report Issues: Open an issue with theme-specific problems
Development Workflow
Making Changes
- Edit Files: Modify content in english
content/en/docs - Preview Changes: Run
make devto see changes live - Translate: Export DEEPL_API_KEY and run
make sync-translationsto sync english changes to target languages - Manually Verify: adjust target translations as needed.
- Commit Changes: Submit pull request with your changes
Adding New Pages
- Create File: Add new
.mdfile in appropriate directory - Add Front Matter: Include all required attributes
- File Structure: Place file in appropriate directory for automatic ordering
- Add to Index: Update
_index.mdif needed - Test: Verify page appears in correct location
Updating Existing Pages
- Edit Content: Modify the markdown content
- Update lastmod: Always update the
lastmodfield to current date/time - Update Front Matter: Adjust title or description if needed
- Test Changes: Use
make devto preview - Translate: Export DEEPL_API_KEY and run
make sync-translationsto sync english changes to target languages - Manually Verify: adjust target translations as needed.
- Submit PR: Create pull request with changes
Managing Dates
When creating new content:
- Set
dateto when you first publish the article - Set
lastmodto the same value initially - Use ISO 8601 format:
"2024-01-15T10:00:00Z"
When updating existing content:
- Keep
dateunchanged (original publication date) - Update
lastmodto current date/time - This helps users see when content was last updated
Date Format Examples:
Custom Ordering with order Field
When to use order:
- You need a specific page to appear first in its directory
- You want a troubleshooting guide to appear last
- You need to override alphabetical ordering for better UX
Example Scenario: In a directory with multiple pages, you want:
- Overview page first
- Other pages in alphabetical order
- Troubleshooting page last
Front Matter Examples:
| |
Multiple Ordered Pages:
| |
Best Practices
Content Guidelines
- Clear Titles: Use descriptive, concise titles
- Good Descriptions: Write helpful descriptions for navigation
- Appropriate Icons: Choose icons that represent the content
File Organization
- Group Related Content: Keep related pages in the same directory
- Use Subdirectories: Organize complex sections with subdirectories
- Consistent Naming: Use kebab-case for file names
- Index Pages: Include
_index.mdfor each section
Writing Style
- Clear and Concise: Write for users of all technical levels
- Code Examples: Include working code examples
- Cross-References: Link to related pages
- Consistent Formatting: Follow existing formatting patterns