Clarify that .Lastmod automatically uses .GitInfo.AuthorDate (#226)

If the `lastmod` field in the content front matter is not set if `.GitInfo` is
enabled, Page's .Lastmod is auto-set to .GitInfo.AuthorDate.
This commit is contained in:
Kaushal Modi 2017-10-04 10:29:02 -04:00 committed by digitalcraftsman
parent 000ab7c423
commit 62d7b269fb
2 changed files with 12 additions and 1 deletions

View File

@ -51,4 +51,8 @@ The `GitInfo` object contains the following fields:
`.Subject`
: commit message subject (e.g., `tpl: Add custom index function`)
## `.Lastmod`
If the `.GitInfo` feature is enabled, **and** if the `lastmod` field in the content's front matter is not set, `.Lastmod` (on `Page`) is fetched from Git i.e. `.GitInfo.AuthorDate`.
[configuration]: /getting-started/configuration/

View File

@ -79,7 +79,12 @@ See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables.
`config`.
`.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, Hugo will default to the `date` field. See also `.ExpiryDate`, `.Date`, and `.PublishDate`.
: 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.
- If `lastmod` is not set, and `.GitInfo` feature is enabled, `.GitInfo.AuthorDate` will be used instead.
See also `.ExpiryDate`, `.Date`, `.PublishDate`, and [`.GitInfo`][gitinfo].
`.LinkTitle`
: access when creating links to the content. If set, Hugo will use the `linktitle` from the front matter before `title`.
@ -266,3 +271,5 @@ The top-level key will be preferred. Therefore, the following method, when appli
{{ $.Param "favorites.flavor" }}
=> vanilla
```
[gitinfo]: /variables/git/