From bf9d11d23afcd3028a87b9d7f42a2435eed970c2 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sat, 18 Dec 2021 10:07:38 +1100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20article=20last=20updated=20da?= =?UTF-8?q?te=20support=20(Ref:=20#43)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++- exampleSite/content/docs/configuration.md | 1 + exampleSite/content/docs/front-matter.md | 5 +++-- layouts/partials/meta/date.html | 7 +++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0afc0790..5c5c46c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### 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 diff --git a/exampleSite/content/docs/configuration.md b/exampleSite/content/docs/configuration.md index 3b1e0f0d..5573531e 100644 --- a/exampleSite/content/docs/configuration.md +++ b/exampleSite/content/docs/configuration.md @@ -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.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.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.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.| diff --git a/exampleSite/content/docs/front-matter.md b/exampleSite/content/docs/front-matter.md index e543ca88..af35dcab 100644 --- a/exampleSite/content/docs/front-matter.md +++ b/exampleSite/content/docs/front-matter.md @@ -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.| |`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.| -|`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.| |`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.| |`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.| |`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.| diff --git a/layouts/partials/meta/date.html b/layouts/partials/meta/date.html index ea38b34b..9d75ac62 100644 --- a/layouts/partials/meta/date.html +++ b/layouts/partials/meta/date.html @@ -1,4 +1,11 @@ +{{ if .Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false) }} +  (Updated:  + + ) +{{ end }} {{- /* Trim EOF */ -}}