Add article last updated date support

(Ref: #43)
pull/61/head
James Panther 2021-12-18 10:07:38 +11:00
parent c7eb77e4ba
commit bf9d11d23a
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
4 changed files with 13 additions and 3 deletions

View File

@ -8,7 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Added ### Added
- Option to display article word counts ([#57](https://github.com/jpanther/congo/pull/57)) - Article word counts ([#57](https://github.com/jpanther/congo/pull/57))
- Last updated dates on articles
### Changed ### Changed

View File

@ -66,6 +66,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
|`homepage.layout`|string|`"page"`|The layout of the homepage. Valid values are `page`, `profile` or `custom`. When set to `custom`, you must provide your own layout by creating a `/layouts/partials/home/custom.html` file. Refer to the [Homepage Layout]({{< ref "homepage-layout" >}}) section for more details.| |`homepage.layout`|string|`"page"`|The layout of the homepage. Valid values are `page`, `profile` or `custom`. When set to `custom`, you must provide your own layout by creating a `/layouts/partials/home/custom.html` file. Refer to the [Homepage Layout]({{< ref "homepage-layout" >}}) section for more details.|
|`homepage.showRecent`|boolean|`false`|Whether or not to display the recent articles list on the homepage.| |`homepage.showRecent`|boolean|`false`|Whether or not to display the recent articles list on the homepage.|
|`article.showDate`|boolean|`true`|Whether or not article dates are displayed.| |`article.showDate`|boolean|`true`|Whether or not article dates are displayed.|
|`article.showDateUpdated`|boolean|`false`|Whether or not the dates articles were updated are displayed.|
|`article.dateFormat`|string|`"2 January 2006"`|How article dates are formatted. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.| |`article.dateFormat`|string|`"2 January 2006"`|How article dates are formatted. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.|
|`article.showAuthor`|boolean|`true`|Whether or not the author box is displayed in the article footer.| |`article.showAuthor`|boolean|`true`|Whether or not the author box is displayed in the article footer.|
|`article.showBreadcrumbs`|boolean|`false`|Whether or not breadcrumbs are displayed in the article header.| |`article.showBreadcrumbs`|boolean|`false`|Whether or not breadcrumbs are displayed in the article header.|

View File

@ -23,13 +23,14 @@ Front matter parameter default values are inherited from the theme's [base confi
|`robots`|string|_Not set_|String that indicates how robots should handle this article. If set, it will be output in the page head. Refer to [Google's docs](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives) for valid values.| |`robots`|string|_Not set_|String that indicates how robots should handle this article. If set, it will be output in the page head. Refer to [Google's docs](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives) for valid values.|
|`sharingLinks`|array of strings|`article.sharingLinks`|Which sharing links to display at the end of this article. When not provided, or set to `false` no links will be displayed.| |`sharingLinks`|array of strings|`article.sharingLinks`|Which sharing links to display at the end of this article. When not provided, or set to `false` no links will be displayed.|
|`showAuthor`|boolean|`article.showAuthor`|Whether or not the author box is displayed in the article footer.| |`showAuthor`|boolean|`article.showAuthor`|Whether or not the author box is displayed in the article footer.|
|`showDate`|boolean|`article.showDate`|Whether or not article dates are displayed.| |`showDate`|boolean|`article.showDate`|Whether or not the article date is displayed. The date is set using the `date` parameter.|
|`showDateUpdated`|boolean|`article.showDateUpdated`|Whether or not the date the article was updated is displayed. The date is set using the `lastmod` parameter.|
|`showEdit`|boolean|`article.showEdit`|Whether or not the link to edit the article content should be displayed.| |`showEdit`|boolean|`article.showEdit`|Whether or not the link to edit the article content should be displayed.|
|`showHeadingAnchors`|boolean|`article.showHeadingAnchors`|Whether or not heading anchor links are displayed alongside headings within this article.| |`showHeadingAnchors`|boolean|`article.showHeadingAnchors`|Whether or not heading anchor links are displayed alongside headings within this article.|
|`showPagination`|boolean|`article.showPagination`|Whether or not the next/previous article links are displayed in the article footer.| |`showPagination`|boolean|`article.showPagination`|Whether or not the next/previous article links are displayed in the article footer.|
|`showReadingTime`|boolean|`article.showReadingTime`|Whether or not the article reading time is displayed.| |`showReadingTime`|boolean|`article.showReadingTime`|Whether or not the article reading time is displayed.|
|`showWordCount`|boolean|`article.showWordCount`|Whether or not the article word count is displayed.| |`showWordCount`|boolean|`article.showWordCount`|Whether or not the article word count is displayed.|
|`showSummary`|boolean|`list.showSummary`|Whether or not the article summary should be displayed on list pages.| |`showSummary`|boolean|`list.showSummary`|Whether or not the article summary should be displayed on list pages.|
|`summary`|string|_Auto generated using `summaryLength` (see [site configuration]({{< ref "configuration#site-configuration" >}}))_|When `showSummary` is enabled, this is the Markdown string to be used as the summary for this article.| |`summary`|string|Auto generated using `summaryLength` (see [site configuration]({{< ref "configuration#site-configuration" >}}))|When `showSummary` is enabled, this is the Markdown string to be used as the summary for this article.|
|`xml`|boolean|`true` unless excluded by `sitemap.excludedKinds`|Whether or not this article is included in the generated `/sitemap.xml` file.| |`xml`|boolean|`true` unless excluded by `sitemap.excludedKinds`|Whether or not this article is included in the generated `/sitemap.xml` file.|
<!-- prettier-ignore-end --> <!-- prettier-ignore-end -->

View File

@ -1,4 +1,11 @@
<time datetime="{{ .Date }}"> <time datetime="{{ .Date }}">
{{- .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" -}} {{- .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" -}}
</time> </time>
{{ if .Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false) }}
&nbsp;(Updated:&nbsp;
<time datetime="{{ .Lastmod }}">
{{- .Lastmod.Format .Site.Params.article.dateFormat | default "2 January 2006" -}}
</time>
)
{{ end }}
{{- /* Trim EOF */ -}} {{- /* Trim EOF */ -}}