From c5107ab693ba801221da3adea5d60ebd8f74214a Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Wed, 18 Aug 2021 17:06:14 +1000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20JSON-LD=20structured=20metada?= =?UTF-8?q?ta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +- config/_default/params.toml | 4 ++- exampleSite/content/docs/configuration.md | 3 +- layouts/partials/head.html | 2 +- layouts/partials/recent-articles.html | 2 +- layouts/partials/schema.html | 40 +++++++++++++++++++++++ 6 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 layouts/partials/schema.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 0135c446..e67c6f27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,11 +17,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Recent articles partial - CSS transitions - Hugo module support +- JSON-LD structured metadata ### Changed - ⚠️ Renamed parameter: `homepage.showList` -> `homepage.showRecent` -- ⚠️ Renamed parameter: `homepage.listSections` -> `homepage.mainSections` +- ⚠️ Renamed parameter: `homepage.listSections` -> `mainSections` - ⚠️ Consolidated author configuration parameters into `config.toml` - General style tweaks to enhance design consistency diff --git a/config/_default/params.toml b/config/_default/params.toml index 594f3a53..7648c2cc 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -5,10 +5,12 @@ # Refer to the theme docs for more details about each of these parameters. # https://jpanther.github.io/Congo/docs/configuration/#theme-parameters +# description = "My awesome website" +# mainSections = ["section1", "section2"] + [homepage] layout = "page" # valid options: page, profile, custom showRecent = false - # mainSections = ["section1", "section2"] [article] showDate = true diff --git a/exampleSite/content/docs/configuration.md b/exampleSite/content/docs/configuration.md index 07976035..b5f20820 100644 --- a/exampleSite/content/docs/configuration.md +++ b/exampleSite/content/docs/configuration.md @@ -56,9 +56,10 @@ Many of the article defaults here can be overridden on a per article basis by sp |Name|Type|Default|Description| | --- | --- | --- | --- | +|`description`|string|_Not set_|The description of the website for metadata purposes.| +|`mainSections`|array of strings|_Not set_|The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used.| |`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](/docs/homepage-layout/) section for more details.| |`homepage.showRecent`|boolean|`false`|Whether or not to display the recent articles list on the homepage.| -|`homepage.mainSections`|array of strings|_Not set_|The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used.| |`article.showDate`|boolean|`true`|Whether or not article dates 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.| diff --git a/layouts/partials/head.html b/layouts/partials/head.html index d53a5705..52063286 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -57,7 +57,7 @@ {{ template "_internal/opengraph.html" . }} {{ template "_internal/twitter_cards.html" . }} {{/* Schema */}} - {{ template "_internal/schema.html" . }} + {{ partial "schema.html" . }} {{/* Generator */}} {{ if .Site.Params.attribution | default true }} {{ hugo.Generator }} diff --git a/layouts/partials/recent-articles.html b/layouts/partials/recent-articles.html index c0422c1a..4d79fc33 100644 --- a/layouts/partials/recent-articles.html +++ b/layouts/partials/recent-articles.html @@ -1,6 +1,6 @@ {{ if .Site.Params.homepage.showRecent | default false }}