Overview
Hugo v0.140+ introduced significant changes to template handling, JSON output, and theme architecture. This page documents proven patterns for automating documentation workflows with Hugo as the core engine, including Svelte 5 integration strategies.
Key Patterns
1. JSON Feed as API
Hugo’s custom output formats let you generate index.json for any section, turning your static site into a headless CMS:
| |
Template (layouts/_default/list.json.json):
| |
Critical: Use .RelPermalink not .Permalink โ absolute URLs break when the domain differs between build and serve environments.
2. Zero-Build Dashboard Integration
Instead of a separate Svelte/Vite build, place a vanilla JS SPA at static/dashboard/index.html. Hugo copies static/ โ public/ verbatim. The dashboard fetches /topics/index.json and renders cards client-side.
Benefits:
- No Node.js dependency in deploy pipeline
- Single
hugo --minifybuild step - Nginx serves everything statically
3. Svelte 5 + Hugo Hybrid Architecture
For interactive components, embed Svelte 5 as hydrated islands within Hugo pages:
| |
Build pipeline:
| |
Hugo shortcode for Svelte islands:
| |
Usage in markdown (shortcode):
| |
4. Content Taxonomy vs Section
Gotcha: Declaring topic = "topics" in [taxonomies] makes content/topics/ a taxonomy, not a section. Section-level index.json won’t generate.
| |
5. Front Matter Tag Arrays
Tags must be proper YAML arrays. Comma-separated strings become a single tag:
| |
6. Hugo 0.140 Template Changes
$.IsMenuand$currentPage.IsMenuremoved โ use simple nav loops without active-state detection.Site.RegularPagesin section templates shows ALL pages โ use.Pagesfor section-scoped listing- JSON templates with
.json.jsonextension are flagged by linters as invalid JSON โ this is a false positive; these are Hugo templates
Svelte 5 Integration Patterns
Pattern A: Vanilla JS Dashboard (Zero Build)
- Current LLM-Wiki approach
- No Svelte dependency in production
- Best for: read-only dashboards, search, filtering
Pattern B: Svelte 5 Islands (Partial Hydration)
- Hugo renders static content
- Svelte 5 hydrates interactive widgets
- Best for: calculators, forms, real-time widgets
Pattern C: SvelteKit + Hugo Hybrid
- SvelteKit for app routes
- Hugo for content routes
- Shared component library
- Best for: full apps with documentation
Automation Pipeline
| |
- Research script generates/updates markdown with proper front matter
- Hugo builds HTML + JSON output
- Dashboard fetches JSON, renders searchable card grid
- Deploy:
hugo --minify && sudo nginx -t && sudo systemctl reload nginx
Svelte 5 Component Structure for Hugo
| |
vite.config.ssg.ts:
| |
Related Topics
- Svelte 5 Best Practices
- Svelte 5 Migration Guide
- LLM-Powered Knowledge Bases
- Self-Discovering Documentation
- AI Content Evolution
Evolution Notes
Content last updated: 2026-06-05 Next review: 2026-06-12