Merge commit '00c4484c7092181729f6f470805bc7d72e8ad17b'

This commit is contained in:
Bjørn Erik Pedersen
2022-11-17 16:16:19 +01:00
217 changed files with 2437 additions and 2821 deletions

View File

@@ -34,7 +34,7 @@ The `.File` object contains the following fields:
: the filename without extension or optional language identifier (e.g., `foo`)
.File.ContentBaseName
: is a either TranslationBaseName or name of containing folder if file is a leaf bundle.
: is either a TranslationBaseName or name of containing folder if file is a leaf bundle.
.File.BaseFileName
: the filename without extension (e.g., `foo.en`)

View File

@@ -53,6 +53,6 @@ The `GitInfo` object contains the following fields:
## `.Lastmod`
If the `.GitInfo` feature is enabled, `.Lastmod` (on `Page`) is fetched from Git i.e. `.GitInfo.AuthorDate`. This behaviour can be changed by adding your own [front matter configuration for dates](/getting-started/configuration/#configure-front-matter).
If the `.GitInfo` feature is enabled, `.Lastmod` (on `Page`) is fetched from Git i.e. `.GitInfo.AuthorDate`. This behavior can be changed by adding your own [front matter configuration for dates](/getting-started/configuration/#configure-front-matter).
[configuration]: /getting-started/configuration/

View File

@@ -40,7 +40,7 @@ Reference to the [page object][page-object] associated with the menu entry. This
will be non-nil if the menu entry is set via a page's front-matter and not via
the site config.
.PageRef {{< new-in "0.86.0" >}}
.PageRef
: _string_ <br /> Can be set if defined in site config and the menu entry refers to a Page. [site.GetPage](/functions/getpage/) will be used to do the page lookup. If this is set, you don't need to set the `URL`.
.Name
@@ -67,9 +67,9 @@ a string representing HTML.
.Weight
: _int_ <br />
Value of the `weight` key if set for the menu entry. By default the entries in
a menu are sorted ascending by their `weight`. If that key is not set, and if
the menu entry is set in a page front-matter, this value defaults to the page's
Value of the `weight` key if set for the menu entry. By default the entries in
a menu are sorted ascending by their `weight`. If that key is not set, and if
the menu entry is set in a page front-matter, this value defaults to the page's
`.Weight`.
.Parent
@@ -123,6 +123,5 @@ See [`.IsMenuCurrent` method](/functions/ismenucurrent/).
: _(menu string, menuEntry *MenuEntry) boolean_ <br />
See [`.HasMenuCurrent` method](/functions/hasmenucurrent/).
[menu-template]: /templates/menu-templates/
[page-object]: /variables/page/

View File

@@ -4,7 +4,6 @@ linktitle:
description: Page-level variables are defined in a content file's front matter, derived from the content's file location, or extracted from the content body itself.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [variables and params]
keywords: [pages]
draft: false
@@ -106,16 +105,16 @@ See also `.ExpiryDate`, `.Date`, `.PublishDate`, and [`.GitInfo`][gitinfo].
.Pages
: a collection of associated pages. This value will be `nil` within
the context of regular content pages. See [`.Pages`](#pages).
the context of regular content pages. See [`.Pages`]({{< relref "page.md#pages" >}}).
.Permalink
: the Permanent link for this page; see [Permalinks](/content-management/urls/)
.Plain
: the Page content stripped of HTML tags and presented as a string.
: the Page content stripped of HTML tags and presented as a string. You may need to pipe the result through the [`htmlUnescape`](/functions/htmlunescape/) function when rendering this value with the HTML [output format](/templates/output-formats#output-format-definitions).
.PlainWords
: the slice of strings that results from splitting .Plain into words, as defined in Go's [strings.Fields](https://golang.org/pkg/strings/#Fields).
: the slice of strings that results from splitting .Plain into words, as defined in Go's [strings.Fields](https://pkg.go.dev/strings#Fields).
.Prev
: Points down to the previous [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath)). Example: `{{if .Prev}}{{.Prev.Permalink}}{{end}}`. Calling `.Prev` from the last page returns `nil`.
@@ -201,7 +200,7 @@ aliased form `.Pages`.
Any other value defined in the front matter in a content file, including taxonomies, will be made available as part of the `.Params` variable.
```
```yml
---
title: My First Post
date: 2017-02-20T15:26:23-06:00
@@ -220,7 +219,7 @@ Page-level `.Params` are *only* accessible in lowercase.
The `.Params` variable is particularly useful for the introduction of user-defined front matter fields in content files. For example, a Hugo website on book reviews could have the following front matter in `/content/review/book01.md`:
```
```yml
---
...
affiliatelink: "http://www.my-book-link.here"
@@ -253,7 +252,7 @@ See [Archetypes](/content-management/archetypes/) for consistency of `Params` ac
In Hugo, you can declare params in individual pages and globally for your entire website. A common use case is to have a general value for the site param and a more specific value for some of the pages (i.e., a header image):
```
```go-html-template
{{ $.Param "header_image" }}
```
@@ -263,7 +262,7 @@ The `.Param` method provides a way to resolve a single value according to it's d
When front matter contains nested fields like the following:
```
```yml
---
author:
given_name: John
@@ -273,13 +272,13 @@ author:
```
`.Param` can access these fields by concatenating the field names together with a dot:
```
```go-html-template
{{ $.Param "author.display_name" }}
```
If your front matter contains a top-level key that is ambiguous with a nested key, as in the following case:
```
```yml
---
favorites.flavor: vanilla
favorites:
@@ -289,7 +288,7 @@ favorites:
The top-level key will be preferred. Therefore, the following method, when applied to the previous example, will print `vanilla` and not `chocolate`:
```
```txt
{{ $.Param "favorites.flavor" }}
=> vanilla
```

View File

@@ -23,8 +23,8 @@ Also see [List templates](/templates/lists) for an overview of sort methods.
`.Next` and `.Prev` on `Pages` work similar to the methods with the same names on `.Page`, but are more flexible (and slightly slower) as they can be used on any page collection.
`.Next` points **up** to the next page relative to the page sent in as the argument. Example: `{{with .Site.RegularPages.Next . }}{{.RelPermalink}}{{end}}`. Calling `.Next` with the first page in the collection returns `nil`.
`.Next` points **up** to the next page relative to the page sent in as the argument. Example: `{{with .Site.RegularPages.Next . }}{{.RelPermalink}}{{end}}`. Calling `.Next` with the first page in the collection returns `nil`.
## .Prev PAGE
`.Prev` points **down** to the previous page relative to the page sent in as the argument. Example: `{{with .Site.RegularPages.Prev . }}{{.RelPermalink}}{{end}}`. Calling `.Prev` with the last page in the collection returns `nil`.
`.Prev` points **down** to the previous page relative to the page sent in as the argument. Example: `{{with .Site.RegularPages.Prev . }}{{.RelPermalink}}{{end}}`. Calling `.Prev` with the last page in the collection returns `nil`.

View File

@@ -4,10 +4,8 @@ linktitle: Shortcode Variables
description: Shortcodes can access page variables and also have their own specific built-in variables.
date: 2017-03-12
publishdate: 2017-03-12
lastmod: 2017-03-12
categories: [variables and params]
keywords: [shortcodes]
draft: false
menu:
docs:
parent: "variables"
@@ -47,6 +45,3 @@ toc: false
.InnerDeindent {{< new-in "0.100.0" >}}
: Gets the `.Inner` with any indentation removed. This is what's used in the built-in `{{</* highlight */>}}` shortcode.

View File

@@ -22,7 +22,7 @@ The following is a list of site-level (aka "global") variables. Many of these va
## Get the Site object from a partial
All the methods below, e.g. `.Site.RegularPages` can also be reached via the global [`site`](/functions/site/) function, e.g. `site.RegularPages`, which can be handy in partials where the `Page` object isn't easily available. {{< new-in "0.53" >}}.
All the methods below, e.g. `.Site.RegularPages` can also be reached via the global [`site`](/functions/site/) function, e.g. `site.RegularPages`, which can be handy in partials where the `Page` object isn't easily available.
## Site Variables List
@@ -84,13 +84,13 @@ All the methods below, e.g. `.Site.RegularPages` can also be reached via the glo
: 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
: all of the menus in the site.
: all the menus in the site.
.Site.Pages
: array of all content ordered by Date with the newest first. This array contains only the pages in the current language. See [`.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. See [`.Site.Pages`]({{< relref "site.md#site-pages" >}}).
.Site.RegularPages
: a shortcut to the *regular* page collection. `.Site.RegularPages` is equivalent to `where .Site.Pages "Kind" "page"`. See [`.Site.Pages`](#site-pages).
: a shortcut to the *regular* page collection. `.Site.RegularPages` is equivalent to `where .Site.Pages "Kind" "page"`. See [`.Site.Pages`]({{< relref "site.md#site-pages" >}}).
.Site.Sections
: top-level directories of the site.
@@ -129,7 +129,4 @@ You can use `.Site.Params` in a [partial template](/templates/partials/) to call
{{< getcontent path="readfiles/pages-vs-site-pages.md" >}}
[config]: /getting-started/configuration/

View File

@@ -4,7 +4,6 @@ linktitle: Sitemap Variables
description:
date: 2017-03-12
publishdate: 2017-03-12
lastmod: 2017-03-12
categories: [variables and params]
keywords: [sitemap]
draft: false
@@ -29,4 +28,4 @@ A sitemap is a `Page` and therefore has all the [page variables][pagevars] avail
.Sitemap.Filename
: the sitemap filename
[pagevars]: /variables/page/
[pagevars]: /variables/page/