Home and landing pages
An OINK home page is data, not a template. data/home/<language>.yaml lists
the sections from top to bottom (a hero, a grid of cards, pricing, a closing
call to action) and holds the content of each, so you change the page by
editing YAML and never touch HTML. Any other page can use the same sections as
a landing page.
Edit the Starter’s home page
The OINK Starter ships a three-section home page in
data/home/en.yaml. Replace the text and links with your own and the browser
reloads with the result:
Write internal links as site paths without a leading slash, such as
docs/install/; the theme adds the language prefix, so the same link reaches
/zh/docs/install/ from the Chinese home page. To add a section, append its
name to sections and give it a key of the same name; to reorder the page,
reorder the list. The section types table lists everything
available.
Where the data lives
The home page’s content file holds only its title and description:
The sections live in one data file per language:
home page data
data/
home/
- en.yamlEnglish home page
- zh.yamlChinese home page
For each language the theme reads data/home/<language>.yaml, falls back to
data/home/en.yaml, and on a single-language site accepts a plain
data/home.yaml.
Each file has two levels: the sections list, and the keys it names. A section
normally reads the key that matches its type; give it a key to read another,
which is how one page shows two card grids:
Section entries
An entry in sections is either a type name or a map:
| Key | What it does |
|---|---|
type |
The section type. If omitted, key is used as the type |
key |
The top-level key that holds the data. Defaults to the type name; use it to tell two sections of the same type apart |
data |
The section’s data inline, instead of under a top-level key |
id |
The section’s anchor ID, generated from key or type by default |
enabled: false |
Hides the section and keeps its data |
partial |
Renders the data with one of the site’s own partials. This ties the data to your templates, so it no longer moves between sites |
Type names use hyphens (logo-wall); underscores are accepted and normalized.
A misspelled type warns with unknown section type and the section is
skipped. A home page migrated from Docsy’s blocks/* shortcodes has to be
rebuilt this way; see Migrating from Docsy.
Hero
The hero is the first screen, and the only section with a large title and an illustration:
An image path names a file under the site’s static/ or assets/; the example
expects static/images/hero-light.webp and static/images/hero-dark.webp.
The image is a CSS background: with alt its container is announced as an image with
that label, and without alt it is hidden from assistive technology. Without
title_lines the hero shows title, and without either it shows the site
title.
align: center gives a text-only first screen, as in the Starter: the text
block widens and centers, title lines are balanced, and note moves below the
buttons. A centered hero cannot hold an image, so when both are present the
theme warns and keeps start alignment and the image.
Section types
There are 22 section types. Every type except hero accepts the same heading
fields, eyebrow, title and desc (or text), plus a class for your own
CSS.
| Type | What it holds |
|---|---|
hero |
The first screen: large title, buttons, an image that follows light and dark mode |
metrics |
Numeric facts, with optional count animation and source links |
capabilities |
Capabilities described one per row, alternating sides, each with a visual panel |
principles |
Numbered product principles |
cards |
A general card grid: features, use cases, entry points |
logo-wall |
Tools and partners, as a grid or a pure-CSS marquee |
gallery |
A wall of screenshots |
testimonials |
Quotations with attribution |
contributors |
People, roles, avatars and links |
faq |
Questions and answers, collapsible or flat |
markdown |
Free Markdown content |
cta |
The closing call to action |
pricing |
Pricing tier cards |
pricing-compare |
A tier-by-feature comparison matrix |
command-box |
One copyable command |
steps |
An ordered procedure, optionally with commands |
timeline |
Dated milestones |
code-plate |
Code inside a presentation panel |
preview |
Markdown source beside its rendered result |
case-study |
A case: metrics, a quotation and its source |
download |
One or more data/download/ records |
bar-chart |
Numeric comparison drawn without chart JavaScript |
Common sections
cards sets its column count with columns:
capabilities gives each capability a row of its own with a visual panel
beside it. visual.type is one of shell, components, code, image or
card. In a components panel, items with url become links, and items with
preset become in-place style switchers whenever params.ui.preset_menu offers
that preset:
For a terminal session, use lines to colour the prompt or status prefix of
each line. With the development theme, paste a source snippet into a YAML
block string and set lang to its language. Omit lang for plain text.
Minimal YAML for eleven more sections
The download section reads the same data/download/<key>.yaml records as
Releases and downloads, so a version number is
written once for both.
Landing pages
A pricing page, a product overview or an event page can use the same sections as the home page. Two front matter lines turn an ordinary page into a full-width landing page that keeps the navbar, the command palette and the footer and drops the sidebar and outline:
landing: pricing names the data, which sits beside the home page’s and is
split by language the same way:
landing page data
data/
landing/
pricing/
- en.yaml
- zh.yaml
A single data/landing/pricing.yaml also works: with sections at its top
level it serves every language, and with one map per language code it works
like the directory form. For a language tagged zh-cn, the theme tries
zh-cn, then zh, then en. When it finds nothing, the page warns and
renders the landing shell without sections.
A page with only a section or two can write them in its front matter instead,
each with its data inline. Use either landing: or sections:, not both; with
both, the theme warns and uses the inline sections.
Landing pages show the search button and command palette when the site has
local search on. To leave search off landing pages
other than the home page, set params.ui.landing_search: false.
Languages and local facts
Put each language’s text in its own file (en.yaml, zh.yaml). A record that
is mostly shared facts, such as a pricing tier, can instead carry per-language
fields: the theme reads <field>_<language>, then <field>_<base language>,
then <field>, with - in the language tag written as _. A page in zh-cn
therefore reads title_zh_cn, then title_zh, then title. CamelCase
suffixes are not recognized.
Section text is site data and does not go through the theme’s interface strings; only the theme’s own controls, such as the marquee’s pause button and pricing states, are translated by the theme. For the rest of a multilingual setup, see Languages.
No section fetches anything in the browser: prices, star counts, screenshots,
avatars and download states must all be in the repository when Hugo runs. The
same holds for the two navbar facts you can set in hugo.yml:
The footer has its own data, data/footer/<language>.yaml or data/footer.yaml
on a single-language site; see Navigation and menus.
A footer key left in data/home/<language>.yaml is ignored with a warning
that names the new location.
Output
- HTML: every section rendered on the server, plus
landing.js, loaded only when needed, for reveal effects, counters, copy buttons and light/dark image switching. - Print: the content, with moving parts such as the marquee laid out as a static grid and controls removed.
- Markdown: titles, prose, lists, tables and code, without component classes.
- RSS: no landing sections.
Without JavaScript, or if landing.js fails to load, every section is still
visible: metrics already show their final formatted value, prefix and suffix,
and the marquee’s pause control works without script. Readers who ask for
reduced motion get no movement or reveal effects.
Verify
- Run
hugo --printPathWarnings. Misspelled types, missing data keys and a page with bothlandingandsectionsare reported here. - Open the home page and each landing page in every language, and compare the sections with their data files.
- Reload with JavaScript disabled; the content stays, only the motion goes.
- Switch between light and dark mode and check that
image.lightandimage.darkeach appear in the right one. - On a site deployed under a subpath, check that internal links and images carry the prefix.
Related
- Brand and appearance — site name, logo, colors and fonts
- Navigation and menus — navbar, footer and the language menu
- Releases and downloads — the data behind the
downloadsection - Languages — enabling languages and splitting data by language
- Configuration —
params.ui.landing_search,github_stars,alt_siteand the rest