* extras/permalinks.md added, weighted to third in the extras menu * examples added to layout/go-templates.md, using `.Site.Params` * mention `.Site.Params` in layout/variables.md * update meta/release-notes.md to mention `first` and the permalinks * update overview/configuration.md to use reserved-for-documentation domains and with another example, nudging towards permalinks and site parameters, with three different data-types shown for the latter Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2.4 KiB
title | date | aliases | groups | groups_weight | ||
---|---|---|---|---|---|---|
Variables | 2013-07-01 |
|
|
20 |
Hugo makes a set of values available to the templates. Go templates are context based. The following are available in the context for the templates.
Page Variables
.Title The title for the content.
.Description The description for the content.
.Keywords The meta keywords for this content.
.Date The date the content is published on.
.Indexes These will use the field name of the plural form of the index (see tags and categories above)
.Permalink The Permanent link for this page.
.RelPermalink The Relative permanent link for this page.
.LinkTitle Access when creating links to this content. Will use linktitle if set in front-matter, else title
.FuzzyWordCount The approximate number of words in the content.
.RSSLink Link to the indexes' rss link
.Prev Pointer to the previous content (based on pub date)
.Next Pointer to the following content (based on pub date)
.Site See site variables below
.Content The content itself, defined below the front matter.
.Summary A generated summary of the content for easily showing a snippet in a summary view.
Any value defined in the front matter, including indexes will be made available under .Params
.
Take for example I'm using tags and categories as my indexes. The following would be how I would access them:
.Params.Tags
.Params.Categories
Node Variables
In Hugo a node is any page not rendered directly by a content file. This includes indexes, lists and the homepage.
.Title The title for the content.
.Date The date the content is published on.
.Data The data specific to this type of node.
.Permalink The Permanent link for this node
.Url The relative url for this node.
.RSSLink Link to the indexes' rss link
.Site See site variables below
Site Variables
Also available is .Site
which has the following:
.Site.BaseUrl The base URL for the site as defined in the config.json file.
.Site.Indexes The indexes for the entire site.
.Site.LastChange The date of the last change of the most recent content.
.Site.Recent Array of all content ordered by Date, newest first.
.Site.Params A container holding the values from params
in your site configuration file.