mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-16 03:01:04 -04:00
Clean up formatting in variable definition lists
This commit is contained in:
parent
149c2c1576
commit
16be43e7d7
@ -24,25 +24,25 @@ For information on creating shortcodes and templates that tap into Hugo's file-r
|
||||
|
||||
The `.File` object contains the following fields:
|
||||
|
||||
`.File.Path`
|
||||
.File.Path
|
||||
: the original relative path of the page (e.g., `content/posts/foo.en.md`)
|
||||
|
||||
`.File.LogicalName`
|
||||
.File.LogicalName
|
||||
: the name of the content file that represents a page (e.g., `foo.en.md`)
|
||||
|
||||
`.File.TranslationBaseName`
|
||||
.File.TranslationBaseName
|
||||
: the filename without extension or optional language identifier (e.g., `foo`)
|
||||
|
||||
`.File.BaseFileName`
|
||||
.File.BaseFileName
|
||||
: the filename without extension (e.g., `foo.en`)
|
||||
|
||||
`.File.Ext`
|
||||
.File.Ext
|
||||
: the file extension of the content file (e.g., `md`); this can also be called using `.File.Extension` as well. Note that it is *only* the extension without `.`.
|
||||
|
||||
`.File.Lang`
|
||||
.File.Lang
|
||||
: the language associated with the given file if Hugo's [Multilingual features][multilingual] are enabled (e.g., `en`)
|
||||
|
||||
`.File.Dir`
|
||||
.File.Dir
|
||||
: given the path `content/posts/dir1/dir2/`, the relative directory path of the content file will be returned (e.g., `posts/dir1/dir2/`)
|
||||
|
||||
[Multilingual]: /content-management/multilingual/
|
@ -33,22 +33,22 @@ Hugo's Git integrations should be fairly performant but *can* increase your buil
|
||||
|
||||
The `GitInfo` object contains the following fields:
|
||||
|
||||
`.AbbreviatedHash`
|
||||
.AbbreviatedHash
|
||||
: the abbreviated commit hash (e.g., `866cbcc`)
|
||||
|
||||
`.AuthorName`
|
||||
.AuthorName
|
||||
: the author's name, respecting `.mailmap`
|
||||
|
||||
`.AuthorEmail`
|
||||
.AuthorEmail
|
||||
: the author's email address, respecting `.mailmap`
|
||||
|
||||
`.AuthorDate`
|
||||
.AuthorDate
|
||||
: the author date
|
||||
|
||||
`.Hash`
|
||||
.Hash
|
||||
: the commit hash (e.g., `866cbccdab588b9908887ffd3b4f2667e94090c3`)
|
||||
|
||||
`.Subject`
|
||||
.Subject
|
||||
: commit message subject (e.g., `tpl: Add custom index function`)
|
||||
|
||||
## `.Lastmod`
|
||||
|
@ -21,16 +21,16 @@ wip: false
|
||||
|
||||
It contains the following fields:
|
||||
|
||||
`.Hugo.Generator`
|
||||
.Hugo.Generator
|
||||
: `<meta>` tag for the version of Hugo that generated the site. `.Hugo.Generator` outputs a *complete* HTML tag; e.g. `<meta name="generator" content="Hugo 0.18" />`
|
||||
|
||||
`.Hugo.Version`
|
||||
.Hugo.Version
|
||||
: the current version of the Hugo binary you are using e.g. `0.13-DEV`<br>
|
||||
|
||||
`.Hugo.CommitHash`
|
||||
.Hugo.CommitHash
|
||||
: the git commit hash of the current Hugo binary e.g. `0e8bed9ccffba0df554728b46c5bbf6d78ae5247`
|
||||
|
||||
`.Hugo.BuildDate`
|
||||
.Hugo.BuildDate
|
||||
: the compile date of the current Hugo binary formatted with RFC 3339 e.g. `2002-10-02T10:00:00-05:00`<br>
|
||||
|
||||
{{% note "Use the Hugo Generator Tag" %}}
|
||||
|
@ -20,31 +20,31 @@ toc: false
|
||||
|
||||
The [menu template][] has the following properties:
|
||||
|
||||
`.URL`
|
||||
.URL
|
||||
: string
|
||||
|
||||
`.Name`
|
||||
.Name
|
||||
: string
|
||||
|
||||
`.Menu`
|
||||
.Menu
|
||||
: string
|
||||
|
||||
`.Identifier`
|
||||
.Identifier
|
||||
: string
|
||||
|
||||
`.Pre`
|
||||
.Pre
|
||||
: template.HTML
|
||||
|
||||
`.Post`
|
||||
.Post
|
||||
: template.HTML
|
||||
|
||||
`.Weight`
|
||||
.Weight
|
||||
: int
|
||||
|
||||
`.Parent`
|
||||
.Parent
|
||||
: string
|
||||
|
||||
`.Children`
|
||||
.Children
|
||||
: Menu
|
||||
|
||||
[menu template]: /templates/menu-templates/
|
@ -26,65 +26,65 @@ See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables.
|
||||
|
||||
## Page Variables
|
||||
|
||||
`.AlternativeOutputFormats`
|
||||
.AlternativeOutputFormats
|
||||
: contains all alternative formats for a given page; this variable is especially useful `link rel` list in your site's `<head>`. (See [Output Formats](/templates/output-formats/).)
|
||||
|
||||
`.Content`
|
||||
.Content
|
||||
: the content itself, defined below the front matter.
|
||||
|
||||
`.Data`
|
||||
.Data
|
||||
: the data specific to this type of page.
|
||||
|
||||
`.Date`
|
||||
.Date
|
||||
: the date associated with the page; `.Date` pulls from the `date` field in a content's front matter. See also `.ExpiryDate`, `.PublishDate`, and `.Lastmod`.
|
||||
|
||||
`.Description`
|
||||
.Description
|
||||
: the description for the page.
|
||||
|
||||
`.Dir`
|
||||
.Dir
|
||||
: the path of the folder containing this content file. The path is relative to the `content` folder.
|
||||
|
||||
`.Draft`
|
||||
.Draft
|
||||
: a boolean, `true` if the content is marked as a draft in the front matter.
|
||||
|
||||
`.ExpiryDate`
|
||||
.ExpiryDate
|
||||
: the date on which the content is scheduled to expire; `.ExpiryDate` pulls from the `expirydate` field in a content's front matter. See also `.PublishDate`, `.Date`, and `.Lastmod`.
|
||||
|
||||
`.File`
|
||||
.File
|
||||
: filesystem-related data for this content file. See also [File Variables][].
|
||||
|
||||
`.FuzzyWordCount`
|
||||
.FuzzyWordCount
|
||||
: the approximate number of words in the content.
|
||||
|
||||
`.Hugo`
|
||||
.Hugo
|
||||
: see [Hugo Variables](/variables/hugo/).
|
||||
|
||||
`.IsHome`
|
||||
.IsHome
|
||||
: `true` in the context of the [homepage](/templates/homepage/).
|
||||
|
||||
`.IsNode`
|
||||
.IsNode
|
||||
: always `false` for regular content pages.
|
||||
|
||||
`.IsPage`
|
||||
.IsPage
|
||||
: always `true` for regular content pages.
|
||||
|
||||
`.IsTranslated`
|
||||
.IsTranslated
|
||||
: `true` if there are translations to display.
|
||||
|
||||
`.Keywords`
|
||||
.Keywords
|
||||
: the meta keywords for the content.
|
||||
|
||||
`.Kind`
|
||||
.Kind
|
||||
: the page's *kind*. Possible return values are `page`, `home`, `section`, `taxonomy`, or `taxonomyTerm`. Note that there are also `RSS`, `sitemap`, `robotsTXT`, and `404` kinds, but these are only available during the rendering of each of these respective page's kind and therefore *not* available in any of the `Pages` collections.
|
||||
|
||||
`.Lang`
|
||||
.Lang
|
||||
: language taken from the language extension notation.
|
||||
|
||||
`.Language`
|
||||
.Language
|
||||
: a language object that points to the language's definition in the site
|
||||
`config`.
|
||||
|
||||
`.Lastmod`
|
||||
.Lastmod
|
||||
: the date the content was last modified. `.Lastmod` pulls from the `lastmod` field in a content's front matter.
|
||||
|
||||
- If `lastmod` is not set, and `.GitInfo` feature is disabled, the front matter `date` field will be used.
|
||||
@ -92,90 +92,90 @@ See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables.
|
||||
|
||||
See also `.ExpiryDate`, `.Date`, `.PublishDate`, and [`.GitInfo`][gitinfo].
|
||||
|
||||
`.LinkTitle`
|
||||
.LinkTitle
|
||||
: access when creating links to the content. If set, Hugo will use the `linktitle` from the front matter before `title`.
|
||||
|
||||
`.Next`
|
||||
.Next
|
||||
: pointer to the following content (based on the `publishdate` field in front matter).
|
||||
|
||||
`.NextInSection`
|
||||
.NextInSection
|
||||
: pointer to the following content within the same section (based on `publishdate` field in front matter).
|
||||
|
||||
`.OutputFormats`
|
||||
.OutputFormats
|
||||
: contains all formats, including the current format, for a given page. Can be combined the with [`.Get` function](/functions/get/) to grab a specific format. (See [Output Formats](/templates/output-formats/).)
|
||||
|
||||
`.Pages`
|
||||
.Pages
|
||||
: a collection of associated pages. This value will be `nil` for regular content pages. `.Pages` is an alias for `.Data.Pages`.
|
||||
|
||||
`.Permalink`
|
||||
.Permalink
|
||||
: the Permanent link for this page; see [Permalinks](/content-management/urls/)
|
||||
|
||||
`.Plain`
|
||||
.Plain
|
||||
: the Page content stripped of HTML tags and presented as a string.
|
||||
|
||||
`.PlainWords`
|
||||
.PlainWords
|
||||
: the Page content stripped of HTML as a `[]string` using Go's [`strings.Fields`](https://golang.org/pkg/strings/#Fields) to split `.Plain` into a slice.
|
||||
|
||||
`.Prev`
|
||||
.Prev
|
||||
: Pointer to the previous content (based on `publishdate` in front matter).
|
||||
|
||||
`.PrevInSection`
|
||||
.PrevInSection
|
||||
: Pointer to the previous content within the same section (based on `publishdate` in front matter). For example, `{{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}`.
|
||||
|
||||
`.PublishDate`
|
||||
.PublishDate
|
||||
: the date on which the content was or will be published; `.Publishdate` pulls from the `publishdate` field in a content's front matter. See also `.ExpiryDate`, `.Date`, and `.Lastmod`.
|
||||
|
||||
`.RSSLink`
|
||||
.RSSLink
|
||||
: link to the taxonomies' RSS link.
|
||||
|
||||
`.RawContent`
|
||||
.RawContent
|
||||
: raw markdown content without the front matter. Useful with [remarkjs.com](
|
||||
http://remarkjs.com)
|
||||
|
||||
`.ReadingTime`
|
||||
.ReadingTime
|
||||
: the estimated time, in minutes, it takes to read the content.
|
||||
|
||||
`.Ref`
|
||||
.Ref
|
||||
: returns the permalink for a given reference (e.g., `.Ref "sample.md"`). `.Ref` does *not* handle in-page fragments correctly. See [Cross References](/content-management/cross-references/).
|
||||
|
||||
`.RelPermalink`
|
||||
.RelPermalink
|
||||
: the relative permanent link for this page.
|
||||
|
||||
`.RelRef`
|
||||
.RelRef
|
||||
: returns the relative permalink for a given reference (e.g., `RelRef
|
||||
"sample.md"`). `.RelRef` does *not* handle in-page fragments correctly. See [Cross References](/content-management/cross-references/).
|
||||
|
||||
`.Site`
|
||||
.Site
|
||||
: see [Site Variables](/variables/site/).
|
||||
|
||||
`.Summary`
|
||||
.Summary
|
||||
: a generated summary of the content for easily showing a snippet in a summary view. The breakpoint can be set manually by inserting <code><!--more--></code> at the appropriate place in the content page. See [Content Summaries](/content-management/summaries/) for more details.
|
||||
|
||||
`.TableOfContents`
|
||||
.TableOfContents
|
||||
: the rendered [table of contents](/content-management/toc/) for the page.
|
||||
|
||||
`.Title`
|
||||
.Title
|
||||
: the title for this page.
|
||||
|
||||
`.Translations`
|
||||
.Translations
|
||||
: a list of translated versions of the current page. See [Multilingual Mode](/content-management/multilingual/) for more information.
|
||||
|
||||
`.Truncated`
|
||||
.Truncated
|
||||
: a boolean, `true` if the `.Summary` is truncated. Useful for showing a "Read more..." link only when necessary. See [Summaries](/content-management/summaries/) for more information.
|
||||
|
||||
`.Type`
|
||||
.Type
|
||||
: the [content type](/content-management/types/) of the content (e.g., `post`).
|
||||
|
||||
`.URL`
|
||||
.URL
|
||||
: 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`
|
||||
.UniqueID
|
||||
: the MD5-checksum of the content file's path.
|
||||
|
||||
`.Weight`
|
||||
.Weight
|
||||
: assigned weight (in the front matter) to this content, used in sorting.
|
||||
|
||||
`.WordCount`
|
||||
.WordCount
|
||||
: the number of words in the content.
|
||||
|
||||
## Section Variables and Methods
|
||||
|
@ -20,13 +20,13 @@ toc: false
|
||||
|
||||
[Shortcodes][shortcodes] have access to parameters delimited in the shortcode declaration via [`.Get`][getfunction], page- and site-level variables, and also the following shortcode-specific fields:
|
||||
|
||||
`.Parent`
|
||||
.Parent
|
||||
: provides access to the parent shortcode context in nested shortcodes. This can be very useful for inheritance of common shortcode parameters from the root.
|
||||
|
||||
`.IsNamedParams`
|
||||
.IsNamedParams
|
||||
: boolean that returns `true` when the shortcode in question uses [named rather than positional parameters][shortcodes]
|
||||
|
||||
`.Inner`
|
||||
.Inner
|
||||
: represents the content between the opening and closing shortcode tags when a [closing shortcode][markdownshortcode] is used
|
||||
|
||||
[getfunction]: /functions/get/
|
||||
|
@ -22,82 +22,82 @@ The following is a list of site-level (aka "global") variables. Many of these va
|
||||
|
||||
## Site Variables List
|
||||
|
||||
`.Site.AllPages`
|
||||
.Site.AllPages
|
||||
: array of all pages, regardless of their translation.
|
||||
|
||||
`.Site.Author`
|
||||
.Site.Author
|
||||
: a map of the authors as defined in the site configuration.
|
||||
|
||||
`.Site.BaseURL`
|
||||
.Site.BaseURL
|
||||
: the base URL for the site as defined in the site configuration.
|
||||
|
||||
`.Site.BuildDrafts`
|
||||
.Site.BuildDrafts
|
||||
: a boolean (default: `false`) to indicate whether to build drafts as defined in the site configuration.
|
||||
|
||||
`.Site.Copyright`
|
||||
.Site.Copyright
|
||||
: a string representing the copyright of your website as defined in the site configuration.
|
||||
|
||||
`.Site.Data`
|
||||
.Site.Data
|
||||
: custom data, see [Data Templates](/templates/data-templates/).
|
||||
|
||||
`.Site.DisqusShortname`
|
||||
.Site.DisqusShortname
|
||||
: a string representing the shortname of the Disqus shortcode as defined in the site configuration.
|
||||
|
||||
`.Site.Files`
|
||||
.Site.Files
|
||||
: all source files for the Hugo website.
|
||||
|
||||
`.Site.GoogleAnalytics`
|
||||
.Site.GoogleAnalytics
|
||||
: a string representing your tracking code for Google Analytics as defined in the site configuration.
|
||||
|
||||
`.Site.IsMultiLingual`
|
||||
.Site.IsMultiLingual
|
||||
: whether there are more than one language in this site. See [Multilingual](/content-management/multilingual/) for more information.
|
||||
|
||||
`.Site.Language.Lang`
|
||||
.Site.Language.Lang
|
||||
: the language code of the current locale (e.g., `en`).
|
||||
|
||||
`.Site.Language.LanguageName`
|
||||
.Site.Language.LanguageName
|
||||
: the full language name (e.g. `English`).
|
||||
|
||||
`.Site.Language.Weight`
|
||||
.Site.Language.Weight
|
||||
: the weight that defines the order in the `.Site.Languages` list.
|
||||
|
||||
`.Site.Language`
|
||||
.Site.Language
|
||||
: indicates the language currently being used to render the website. This object's attributes are set in site configurations' language definition.
|
||||
|
||||
`.Site.LanguageCode`
|
||||
.Site.LanguageCode
|
||||
: a string representing the language as defined in the site configuration. This is mostly used to populate the RSS feeds with the right language code.
|
||||
|
||||
`.Site.LanguagePrefix`
|
||||
.Site.LanguagePrefix
|
||||
: this can be used to prefix URLs to point to the correct language. It will even work when only one defined language. See also the functions [absLangURL](/functions/abslangurl/) and [relLangURL](/functions/rellangurl).
|
||||
|
||||
`.Site.Languages`
|
||||
.Site.Languages
|
||||
: an ordered list (ordered by defined weight) of languages.
|
||||
|
||||
`.Site.LastChange`
|
||||
.Site.LastChange
|
||||
: a string representing the date/time of the most recent change to your site. This string is based on the [`date` variable in the front matter](/content-management/front-matter) of your content pages.
|
||||
|
||||
`.Site.Menus`
|
||||
.Site.Menus
|
||||
: all of the menus in the site.
|
||||
|
||||
`.Site.Pages`
|
||||
.Site.Pages
|
||||
: array of all content ordered by Date with the newest first. This array contains only the pages in the current language.
|
||||
|
||||
`.Site.Permalinks`
|
||||
.Site.Permalinks
|
||||
: a string to override the default [permalink](/content-management/urls/) format as defined in the site configuration.
|
||||
|
||||
`.Site.RegularPages`
|
||||
.Site.RegularPages
|
||||
: a shortcut to the *regular* page collection. `.Site.RegularPages` is equivalent to `where .Site.Pages "Kind" "page"`.
|
||||
|
||||
`.Site.RSSLink`
|
||||
.Site.RSSLink
|
||||
: the URL for the site RSS.
|
||||
|
||||
`.Site.Sections`
|
||||
.Site.Sections
|
||||
: top-level directories of the site.
|
||||
|
||||
`.Site.Taxonomies`
|
||||
.Site.Taxonomies
|
||||
: the [taxonomies](/taxonomies/usage/) for the entire site. Replaces the now-obsolete `.Site.Indexes` since v0.11. Also see section [Taxonomies elsewhere](#taxonomies-elsewhere).
|
||||
|
||||
`.Site.Title`
|
||||
.Site.Title
|
||||
: a string representing the title of the site.
|
||||
|
||||
## The `.Site.Params` Variable
|
||||
|
@ -20,13 +20,13 @@ toc: false
|
||||
|
||||
A sitemap is a `Page` and therefore has all the [page variables][pagevars] available to use sitemap templates. They also have the following sitemap-specific variables available to them:
|
||||
|
||||
`.Sitemap.ChangeFreq`
|
||||
.Sitemap.ChangeFreq
|
||||
: the page change frequency
|
||||
|
||||
`.Sitemap.Priority`
|
||||
.Sitemap.Priority
|
||||
: the priority of the page
|
||||
|
||||
`.Sitemap.Filename`
|
||||
.Sitemap.Filename
|
||||
: the sitemap filename
|
||||
|
||||
[pagevars]: /variables/page/
|
@ -24,22 +24,22 @@ toc: true
|
||||
|
||||
For example, the following fields would be available in `layouts/_defaults/terms.html`, depending on how you organize your [taxonomy templates][taxonomytemplates]:
|
||||
|
||||
`.Data.Singular`
|
||||
.Data.Singular
|
||||
: The singular name of the taxonomy (e.g., `tags => `tag`)
|
||||
|
||||
`.Data.Plural`
|
||||
.Data.Plural
|
||||
: The plural name of the taxonomy (e.g., `tags => tags`)
|
||||
|
||||
`.Data.Pages`
|
||||
.Data.Pages
|
||||
: The list of pages in the taxonomy
|
||||
|
||||
`.Data.Terms`
|
||||
.Data.Terms
|
||||
: The taxonomy itself
|
||||
|
||||
`.Data.Terms.Alphabetical`
|
||||
.Data.Terms.Alphabetical
|
||||
: The taxonomy terms alphabetized
|
||||
|
||||
`.Data.Terms.ByCount`
|
||||
.Data.Terms.ByCount
|
||||
: The Terms ordered by popularity
|
||||
|
||||
Note that `.Data.Terms.Alphabetical` and `.Data.Terms.ByCount` can also be reversed:
|
||||
|
Loading…
x
Reference in New Issue
Block a user