Add missing page vars and predefined FM vars

This commit is contained in:
Ryan Watters 2017-03-13 21:54:13 -05:00
parent 2f1140cbbd
commit 6af744c2ca
2 changed files with 50 additions and 30 deletions

View File

@ -78,36 +78,39 @@ slug: "spf13-vim-3-0-release-and-new-website"
## Front Matter Variables
There are a few predefined variables that Hugo is aware of and utilizes.
### Predefined
### Required
`title`
: The title for the content
`description`
: The description for the content
`date`
: The date the content will be sorted by
`taxonomies`
: These will use the field name of the plural form of the index (see tags and
categories above)
### Optional
There are a few predefined variables that Hugo is aware of. See [Page Variables][pagevars] for how to call many of these predefined variables in your templates.
`aliases`
: An array of one or more aliases (e.g. old published path of a renamed content) that would be created to redirect to this content. See [Aliases][] for details.
: an array of one or more aliases (e.g. old published path of a renamed content) that would be created to redirect to this content. See [Aliases][aliases] for details.
`date`
: the datetime at which the content was created; note this value is auto-populated according to Hugo's built-in [archetype][]
`description`
: the description for the content.
`draft`
: If true, the content will not be rendered unless `hugo` is called with `--buildDrafts`
`expirydate`
: Content already expired will not be rendered unless `hugo` is called with `--buildExpired`
: denotes when content should no longer be published by Hugo; expired will not be rendered unless `hugo` is called with `--buildExpired`
`isCJKLanguage`
: If true, explicitly treat the content as CJKLanguage (`.Summary` and `.WordCount` can work properly in CJKLanguage)
: if `true`, explicitly treat the content as CJKLanguage; both `.Summary` and `.WordCount` can work properly in CJK languages.
`keywords`
: the meta keywords for the content.
`layout`
: the layout Hugo should look for in the [lookup order][] when rendering this content.
`lastmod`
: the datetime at which the content was last modified.
`linktitle`
: used for creating links to content; if set, Hugo defaults to using the `linktitle` before the `title`. Hugo can also [order lists of content by `linktitle`][bylinktitle]
`markup`
: **experimental**; specify `"rst"` for reStructuredText (requires`rst2html`) or `"md"` (default) for Markdown
@ -115,18 +118,31 @@ categories above)
`publishdate`
: If in the future, content will not be rendered unless `hugo` is called with `--buildFuture`
<!-- `sitemap`
: see https://github.com/spf13/hugo/blob/ede452d34ef82a2d6949bf0c5a4584caf3ae03bc/hugolib/page.go#L1062 -->
`slug`
: appears as tail of the url. It can be used to change the part of the url that is based on the filename
: appears as the tail of the URL. When used, it will override the segment of the URL based on the filename.
<!-- `status`
: see https://github.com/spf13/hugo/blob/ede452d34ef82a2d6949bf0c5a4584caf3ae03bc/hugolib/page.go#L1059 -->
`taxonomies`
: these will use the field name of the plural form of the index (see `tags` and
`categories` in the above front matter examples).
`title`
: the title for the content.
`type`
: The type of the content (will be derived from the directory automatically if unset)
: the type of the content; this value will be derived from the directory (i.e., the [section][]) automatically if unset.
`url`
: The full path to the content from the web root. It makes no assumptions about the path of the content file. It also ignores any language prefixes of
: the full path to the content from the web root. It makes no assumptions about the path of the content file. It also ignores any language prefixes of
the multilingual feature.
`weight`
: Used for sorting
: used for sorting; see [list templates][ordering]
{{% note "Hugo's Default URL Destinations" %}}
If neither `slug` nor `url` is present, and [permalinks are not configured otherwise](/content-management/urls/#permalinks), the filename will be used to create the URL for a page. See [Content Organization](/content-management/organization) and [URL Management](/content-management/urls/).
@ -147,15 +163,15 @@ These two user-defined fields can then be accessed via `.Params.include_toc` and
Field names are always normalized to lowercase; e.g., `camelCase: true` is available as `.Params.camelcase`.
{{% /note %}}
## Ordering Through Front Matter
## Ordering Content Through Front Matter
You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][] in list views. You can use `weight` for ordering of content and the convention of [`<TAXONOMY>_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][] to see how `weight` can be used to organize your content in list views.
You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][] in list views. You can use `weight` for ordering of content and the convention of [`<TAXONOMY>_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][ordering] to see the role `weight` in ordering content.
## Overriding Global Blackfriday Configuration
It's possible to set some options for Markdown rendering in a content's front matter as an override to the options set in your site `config`.
See [site configuration][config] for more information on Blackfriday configuration options.
See [Configuration][config] for more information on configuring Blackfriday rendering.
## Front Matter Format Specs
@ -164,11 +180,16 @@ See [site configuration][config] for more information on Blackfriday configurati
* [JSON Spec][]
[aliases]: /content-management/urls/#aliases/
[archetype]: /content-management/archetypes/
[bylinktitle]: /templates/lists/#by-link-title
[config]: /getting-started/configuration/ "Hugo documentation for site configuration"
[contentorg]: /content-management/organization/
[content type]: /content-management/types/
[JSON Spec]: /documents/ecma-404-json-spec.pdf "Specification for JSON, JavaScript Object Notation"
[lookup]: /content-management/l
[ordering]: /templates/lists/ "Hugo provides multiple ways to sort and order your content in list templates"
[pagevars]: /variables/page/
[section]: /content-management/sections/
[taxweight]: /content-management/taxonomies/
[TOML Spec]: https://github.com/toml-lang/toml "Specification for TOML, Tom's Obvious Minimal Language"
[urls]: /content-management/urls/

View File

@ -19,7 +19,7 @@ The following is a list of page-level variables that can be defined for a piece
See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables.
{{% /note %}}
## Page Variables List
## Page Variables
`.Content`
: the content itself, defined below the front matter.
@ -148,8 +148,7 @@ http://remarkjs.com)
: the [content type](/content-management/types/) of the content (e.g., `post`).
`.URL`
: the relative URL for the page. Note that the `URL` set directly in front
matter overrides the default relative URL for the page.
: the URL for the page relative to the web root. Note that a `url` set directly in front matter overrides the default relative URL for the rendered page.
`.UniqueID`
: the MD5-checksum of the content file's path.