This section is primarily here to show how the projects feature works.
What this feature is
The projects section is built with Hugo Content Adapters:
- official docs: https://gohugo.com.cn/content-management/content-adapters/
- adapter file:
content/projects/_content.gotmpl - section index:
content/projects/_index.md - data source:
data/projects/en.jsonanddata/projects/zh_cn.json
Instead of hand-writing one Markdown file per project, Hugo reads the structured data during the build and turns each record into a normal page.
Why this is useful in a theme
This approach is helpful when a section is:
- repetitive in structure
- easier to maintain as JSON, YAML, or TOML
- still expected to behave like normal content pages inside the theme
Once generated, these project pages still use the same layouts, lists, taxonomy pages, RSS output, and multilingual navigation as handwritten content.
How this demo is organized
This example site uses English as the default language and Chinese as the second language, so the projects feature is split like this:
content/projects/_content.gotmplfor Englishcontent/projects/_content.zh-cn.gotmplfor Chinesecontent/projects/_index.mdfor the English section pagecontent/projects/_index.zh-cn.mdfor the Chinese section page
This mirrors Hugo’s multilingual content-adapter pattern: one adapter per language when you want different generated pages for each language.
How to adapt it for your own site
- Keep the
projectssection and its_index.xx.mdfiles. - Replace the records in
data/projects/*.jsonwith your own project data. - Adjust the mapping logic in
_content.gotmplif your fields differ. - Reuse the same single-page layout and shortcodes so the generated pages still feel native inside the theme.
What to inspect
If you want to understand the feature quickly, look at these three places in order:
exampleSite/data/projects/en.jsonexampleSite/data/projects/zh_cn.jsonexampleSite/content/projects/_content.gotmpl