More taxonomy examples in templates.

This commit is contained in:
spf13 2014-08-29 23:41:53 -04:00
parent 6f9f93f34b
commit ba8f652acc
2 changed files with 28 additions and 2 deletions

View file

@ -89,6 +89,32 @@ content tagged with each tag.
{{ partial "footer.html" }} {{ 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 ## Ordering
Hugo can order the meta data in two different ways. It can be ordered by the Hugo can order the meta data in two different ways. It can be ordered by the

View file

@ -34,7 +34,7 @@ matter, content or derived from file location.
**.Permalink** The Permanent link for this page.<br> **.Permalink** The Permanent link for this page.<br>
**.RelPermalink** The Relative 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> **.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> **.RSSLink** Link to the indexes' rss link <br>
**.TableOfContents** The rendered table of contents for this content<br> **.TableOfContents** The rendered table of contents for this content<br>
**.Prev** Pointer to the previous content (based on pub date)<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: 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.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.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.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> **.Site.Params** A container holding the values from `params` in your site configuration file.<br>