From 37e8a8bc91163cf691f708eb9594a5d24e75a815 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Thu, 26 Aug 2021 10:07:37 +1000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20`robots`=20parameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 ++++++--- config/_default/params.toml | 1 + exampleSite/content/docs/configuration.md | 1 + exampleSite/content/docs/front-matter.md | 1 + layouts/partials/head.html | 6 ++++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd7e36ca..61a9a80f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,17 @@ All notable changes to Congo will be documented in this file. Things that need a The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- New `robots` parameter to add metadata to guide robots on how to handle specific content + +### Changed +- URLs are relative by default which allows the theme to be more flexible in different deployment scenarios + ### Fixed - Missing dark style for group subheadings on article listings - Fathom Analytics script included twice when using custom domain - Recent heading on homepage profile layout misaligned -### Changed -- URLs are relative by default which allows the theme to be more flexible in different deployment scenarios - ## [1.2.0] - 2021-08-22 ### Added - Multiple colour schemes diff --git a/config/_default/params.toml b/config/_default/params.toml index cf5abc36..e660ba28 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -8,6 +8,7 @@ colorScheme = "congo" # description = "My awesome website" # mainSections = ["section1", "section2"] +# robots = "" [homepage] layout = "page" # valid options: page, profile, custom diff --git a/exampleSite/content/docs/configuration.md b/exampleSite/content/docs/configuration.md index c2d3bf73..38c16468 100644 --- a/exampleSite/content/docs/configuration.md +++ b/exampleSite/content/docs/configuration.md @@ -57,6 +57,7 @@ Many of the article defaults here can be overridden on a per article basis by sp |`colorScheme`|string|`"congo"`|The theme colour scheme to use. Valid values are `congo` (default), `avocado`, `ocean` and `fire`.| |`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.| +|`robots`|string|_Not set_|String that indicates how robots should handle your site. 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.| |`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.| diff --git a/exampleSite/content/docs/front-matter.md b/exampleSite/content/docs/front-matter.md index 61afe22c..334bd682 100644 --- a/exampleSite/content/docs/front-matter.md +++ b/exampleSite/content/docs/front-matter.md @@ -20,6 +20,7 @@ Front matter parameter default values are inherited from the theme's [base confi |`showEdit`|boolean|`article.showEdit`|Whether or not the link to edit the article content should be displayed.| |`editURL`|string|`article.editURL`|When `showEdit` is active, the URL for the edit link.| |`editAppendPath`|boolean|`article.editAppendPath`|When `showEdit` is active, whether or not the path to the current article should be appended to the URL set at `editURL`.| +|`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.| |`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 article reading times are displayed.| diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 70a3b025..e5efb215 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -22,6 +22,12 @@ {{ with .Site.Params.keywords -}} {{- end }} + {{ with .Site.Params.robots }} + + {{ end }} + {{ with .Params.robots }} + + {{ end }} {{ range .AlternativeOutputFormats -}} {{ printf `` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }}