mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
More taxonomy examples in templates.
This commit is contained in:
parent
6f9f93f34b
commit
ba8f652acc
2 changed files with 28 additions and 2 deletions
|
@ -89,6 +89,32 @@ content tagged with each tag.
|
|||
{{ partial "footer.html" }}
|
||||
|
||||
|
||||
Another example listing the content for each term (ordered by Date)
|
||||
|
||||
|
||||
{{ partial "header.html" . }}
|
||||
{{ partial "subheader.html" . }}
|
||||
|
||||
<section id="main">
|
||||
<div>
|
||||
<h1 id="title">{{ .Title }}</h1>
|
||||
|
||||
{{ $data := .Data }}
|
||||
{{ range $key,$value := .Data.Terms.ByCount }}
|
||||
<h2><a href="{{ $data.Plural }}/{{ $value.Name | urlize }}"> {{ $value.Name }} </a> {{ $value.Count }} </h2>
|
||||
<ul>
|
||||
{{ range $value.Pages.ByDate }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{ partial "footer.html" }}
|
||||
|
||||
## Ordering
|
||||
|
||||
Hugo can order the meta data in two different ways. It can be ordered by the
|
||||
|
|
|
@ -34,7 +34,7 @@ matter, content or derived from file location.
|
|||
**.Permalink** The Permanent link for this page.<br>
|
||||
**.RelPermalink** The Relative permanent link for this page.<br>
|
||||
**.LinkTitle** Access when creating links to this content. Will use linktitle if set in front-matter, else title<br>
|
||||
**.Indexes** These will use the field name of the plural form of the index (see tags and categories above)<br>
|
||||
**.Taxonomies** These will use the field name of the plural form of the index (see tags and categories above)<br>
|
||||
**.RSSLink** Link to the indexes' rss link <br>
|
||||
**.TableOfContents** The rendered table of contents for this content<br>
|
||||
**.Prev** Pointer to the previous content (based on pub date)<br>
|
||||
|
@ -76,7 +76,7 @@ includes indexes, lists and the homepage.
|
|||
Also available is `.Site` which has the following:
|
||||
|
||||
**.Site.BaseUrl** The base URL for the site as defined in the config.json file.<br>
|
||||
**.Site.Indexes** The indexes for the entire site.<br>
|
||||
**.Site.Taxonomies** The indexes for the entire site.<br>
|
||||
**.Site.LastChange** The date of the last change of the most recent content.<br>
|
||||
**.Site.Recent** Array of all content ordered by Date, newest first.<br>
|
||||
**.Site.Params** A container holding the values from `params` in your site configuration file.<br>
|
||||
|
|
Loading…
Reference in a new issue