---
aliases:
- /doc/variables/
- /layout/variables/
lastmod: 2015-12-08
date: 2013-07-01
linktitle: Variables
menu:
main:
parent: layout
next: /templates/content
prev: /templates/functions
title: Template Variables
weight: 20
toc: true
---
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
The following is a list of most of the accessible variables which can be
defined for a piece of content. Many of these will be defined in the front
matter, content or derived from file location.
**See also:** [Scratch](/extras/scratch) for page-scoped writable variables.
**.Content** The content itself, defined below the front matter.
**.Data** The data specific to this type of page.
**.Date** The date the page is associated with.
**.Description** The description for the page.
**.Draft** A boolean, `true` if the content is marked as a draft in the front matter.
**.ExpiryDate** The date where the content is scheduled to expire on.
**.FuzzyWordCount** The approximate number of words in the content.
**.Hugo** See [Hugo Variables]({{< relref "#hugo-variables" >}}) below.
**.IsHome** True if this is the home page.
**.IsNode** Always false for regular content pages.
**.IsPage** Always true for regular content pages.
**.IsTranslated** Whether there are any translations to display.
**.Keywords** The meta keywords for this content.
**.Kind** What *kind* of page is this: is one of *page, home, section, taxonomy or taxonomyTerm.* There are also *RSS, sitemap, robotsTXT and 404*, but these will only available during rendering of that kind of page, and not available in any of the `Pages` collections.
**.Lang** Language taken from the language extension notation.
**.Language** A language object that points to this the language's definition in the site config.
**.Lastmod** The date the content was last modified.
**.LinkTitle** Access when creating links to this content. Will use `linktitle` if set in front matter, else `title`.
**.Next** Pointer to the following content (based on pub date).
**.NextInSection** Pointer to the following content within the same section (based on pub date)
**.Pages** a collection of associated pages. This will be nil for regular content pages. This is an alias for **.Data.Pages**.
**.Permalink** The Permanent link for this page.
**.Prev** Pointer to the previous content (based on pub date).
**.PrevInSection** Pointer to the previous content within the same section (based on pub date). For example, `{{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}`.
**.PublishDate** The date the content is published on.
**.RSSLink** Link to the taxonomies' RSS link.
**.RawContent** Raw Markdown content without the metadata header. Useful with [remarkjs.com](http://remarkjs.com)
**.ReadingTime** The estimated time it takes to read the content in minutes.
**.Ref(ref)** Returns the permalink for `ref`. See [cross-references]({{% ref "extras/crossreferences.md" %}}). Does not handle in-page fragments correctly.
**.RelPermalink** The Relative permanent link for this page.
**.RelRef(ref)** Returns the relative permalink for `ref`. See [cross-references]({{% ref "extras/crossreferences.md" %}}). Does not handle in-page fragments
**.Section** The [section](/content/sections/) this content belongs to.
**.Site** See [Site Variables]({{< relref "#site-variables" >}}) below.
**.Summary** A generated summary of the content for easily showing a snippet in a summary view. Note that the breakpoint can be set manually by inserting <!--more-->
at the appropriate place in the content page. See [Summaries](/content/summaries/) for more details.
**.TableOfContents** The rendered table of contents for this content.
**.Title** The title for this page.
**.Translations** A list of translated versions of the current page. See [Multilingual]({{< relref "content/multilingual.md" >}}) for more info.
**.Truncated** A boolean, `true` if the `.Summary` is truncated. Useful for showing a "Read more..." link only if necessary. See [Summaries](/content/summaries/) for more details.
**.Type** The content [type](/content/types/) (e.g. post).
**.URL** The relative URL for this page. Note that if `URL` is set directly in frontmatter, that URL is returned as-is.
**.UniqueID** The MD5-checksum of the page's filename
**.Weight** Assigned weight (in the front matter) to this content, used in sorting.
**.WordCount** The number of words in the content.
## Page Params
Any other value defined in the front matter, including taxonomies, will be made available under `.Params`.
For example, the *tags* and *categories* taxonomies are accessed with:
* **.Params.tags**
* **.Params.categories**
**All Params are only accessible using all lowercase characters.**
This is particularly useful for the introduction of user defined fields in content files. For example, a Hugo website on book reviews could have in the front matter of /content/review/book01.md
---
...
affiliatelink: "http://www.my-book-link.here"
recommendedby: "my Mother"
---
Which would then be accessible to a template at `/themes/yourtheme/layouts/review/single.html` through `.Params.affiliatelink` and `.Params.recommendedby`, respectively. Two common situations where these could be introduced are as a value of a certain attribute (like `href=""` below) or by itself to be displayed. Sample syntaxes include:
It was recommended by {{ .Params.recommendedby }}.
which would renderIt was recommended by my Mother.
**See also:** [Archetypes]({{% ref "content/archetypes.md" %}}) for consistency of `Params` across pieces of content. ### Param method In Hugo you can declare params both for the site and the individual page. A common use case is to have a general value for the site and a more specific value for some of the pages (i.e. an image). ``` $.Param "image" ``` ### Taxonomy Terms Page Variables [Taxonomy Terms](/templates/terms/) pages are of the type `Page` and have the following additional variables. These are available in `layouts/_defaults/terms.html` for example. **.Data.Singular** The singular name of the taxonomy