hugo/docs/content/indexes/templates.md

1.5 KiB

title date linktitle groups groups_weight
Index Templates 2013-07-01 Templates
indexes
30

There are two different templates that the use of indexes will require you to provide.

The first is a list of all the content assigned to a specific index key. The second is a list of all keys for that index. This document addresses the template used for the first type.

Creating index templates

For each index type a template needs to be provided to render the index page. In the case of tags, this will render the content for /tags/TAGNAME/.

The template must be called the singular name of the index and placed in layouts/indexes

.
└── layouts
    └── indexes
        └── category.html

The template will be provided Data about the index.

Variables

The following variables are available to the index template:

.Title The title for the content.
.Date The date the content is published on.
.Permalink The Permanent link for this page.
.RSSLink Link to the indexes' rss link.
.Data.Pages The content that is assigned this index.
.Data.singular The index itself.

Example

{{% highlight html %}} {{ template "chrome/header.html" . }} {{ template "chrome/subheader.html" . }}

{{ .Title }}

{{ range .Data.Pages }} {{ .Render "summary"}} {{ end }}

{{ template "chrome/footer.html" }} {{% /highlight %}}