3.8 KiB
title, linktitle, description, date, publishdate, lastmod, categories, tags, weight, draft, aliases, toc, wip
| title | linktitle | description | date | publishdate | lastmod | categories | tags | weight | draft | aliases | toc | wip | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Introduction to Lists in Hugo | Hugo Lists | Lists have a specific meaning and usage in Hugo when it comes to rendering your site homepage, section page, taxonomy list, or taxonomy terms list. | 2017-02-01 | 2017-02-01 | 2017-02-01 |
|
|
22 | false |
|
true | true |
What is a List Page Template?
A list page template is a template used to render multiple pieces of content in a single HTML page. The exception to this rule is the homepage, which is still a list but has its own dedicated template).
Hugo uses the term list in its truest sense; i.e. a sequential arrangement of material, especially in alphabetical or numerical order. Hugo uses list templates on any output HTML page where content is traditionally listed:
The idea of a list page comes from the hierarchical mental model of the web and is best demonstrated visually:
List Defaults
Default Templates
Since section lists and taxonomy lists (N.B., not taxonomy terms lists) are both lists with regards to their templates, both have the same terminating default of _default/list.html---or themes/<THEME>/layouts/_default/list.html in the case of a themed project---in their lookup orders. In addition, both section lists and taxonomy lists have their own default list templates in _default:
Default Section Templates
layouts/section/<SECTIONNAME>.htmllayouts/section/list.htmllayouts/_default/section.htmllayouts/_default/list.html
Taxonomy RSS
A Taxonomy’s RSS will be rendered at /PLURAL/TERM/index.xml (e.g. http://spf13.com/topics/golang/index.xml)
{{% note %}} Hugo ships with its own RSS 2.0 template. In most cases this will be sufficient, and an RSS template will not need to be provided by the user. {{% /note %}}
Hugo provides the ability for you to define any RSS type you wish, and can have different RSS files for each section and taxonomy.
/layouts/taxonomy/<SINGULAR>.rss.xml/layouts/_default/rss.xml/themes/<THEME>/layouts/taxonomy/<SINGULAR>.rss.xml/themes/<THEME>/layouts/_default/rss.xml
List Page Variables
A list page is a Page and has all the page variables
and site variables available for use in templates.
Taxonomy list pages will additionally have:
.Data.Singular The taxonomy itself.
See Taxonomy Variables
{{% note %}}
If where or first receives invalid input or a field name that doesn’t exist, it will return an error and stop site generation. where and first also work on taxonomy list templates and taxonomy terms templates. (See Taxonomy Templates.)
{{% /note %}}