From 73218ce192dc8478f695748d7e1fa2e3dd4cb13f Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sun, 15 Aug 2021 10:37:48 +1000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20option=20to=20exclude=20pages?= =?UTF-8?q?=20from=20sitemap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 +++++++++++++++++++- config/_default/params.toml | 3 ++ exampleSite/content/blog/placeholder-text.md | 1 + layouts/_default/sitemap.xml | 5 ++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b29107c3..5007186e 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ Congo is designed to be a fast, lightweight theme for Hugo. It's based upon Tail - [Configuration](#configuration) - [Getting started](#getting-started) - [Organising content](#organising-content) + - [Parameters](#parameters) + - [Front Matter](#front-matter) - [Shortcodes](#shortcodes) - [Alert](#alert) - [Icon](#icon) @@ -147,7 +149,9 @@ It's also useful to set the author configuration in the `config/_default/author. [author] name = "Your name" -twitter = "https://twitter.com/username" +links = [ + { twitter = "https://twitter.com/username" } +] ``` ### Organising content @@ -182,6 +186,32 @@ When you create a new taxonomy, you will need to adjust the navigation links on weight = 20 ``` +### Parameters + +Congo provides a large number of configuration parameters that control how the theme functions. The table below outlines every available parameter in the `config/_default/params.toml` file. + + +|Name|Type|Default|Description| +| --- | --- | --- | --- | +|`article.showDate`|boolean|`true`|Whether or not the article date is displayed.| +|`article.dateFormat`|string|`"2 January 2006"`|How the article date is formatted. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.| +|`article.showReadingTime`|boolean|`true`|Whether or not reading time is displayed.| +|`article.showAuthor`|boolean|`true`|Whether or not the author box is displayed in the article footer.| +|`article.showPagination`|boolean|`true`|Whether or not the next/previous article links are displayed in the article footer.| +|`taxonomy.showTermCount`|boolean|`true`|Whether or not the number of articles within a taxonomy term is displayed on the taxonomy listing.| +|`sitemap.excludedKinds`|array of strings|`["taxonomy", "term"]`|Kinds of content that should be excluded from the generated `sitemap.xml` file. Refer to the [Hugo docs](https://gohugo.io/templates/section-templates/#page-kinds) for acceptable values.| + + +## Front Matter + +In addition to the default Hugo front matter parameters, Congo adds a number of additional options to customise the presentation of individual articles. All the available theme parameters are listed below. Keep in mind that you only need to specify these parameters in your front matter when you want to override the default. + + +|Name|Type|Default|Description| +| --- | --- | --- | --- | +|`xml`|boolean|`true`|Whether or not this article is included in the generated sitemap.xml file.| + + ## Shortcodes In addition to all the [default Hugo shortcodes](https://gohugo.io/content-management/shortcodes/), Congo adds a few extras for additional functionality. diff --git a/config/_default/params.toml b/config/_default/params.toml index 7d4c6292..9eec6d7b 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -12,6 +12,9 @@ [taxonomy] showTermCount = true +[sitemap] + excludedKinds = ["taxonomy", "term"] + # -- Site Verification -- # Provide the verification strings for the providers below and the # corresponding meta tags will be added to the site
. diff --git a/exampleSite/content/blog/placeholder-text.md b/exampleSite/content/blog/placeholder-text.md index 02fb8c35..8e9ecfd8 100755 --- a/exampleSite/content/blog/placeholder-text.md +++ b/exampleSite/content/blog/placeholder-text.md @@ -4,6 +4,7 @@ date: "2019-03-09" draft: true description: "Lorem Ipsum Dolor Si Amet" tags: ["markdown", "text"] +xml: false --- Lorem est tota propiore conpellat pectoribus de pectora summo. Redit teque digerit hominumque toris verebor lumina non cervice subde tollit usus habet Arctonque, furores quas nec ferunt. Quoque montibus nunc caluere tempus inhospita parcite confusaque translucet patri vestro qui optatis lumine cognoscere flos nubis! Fronde ipsamque patulos Dryopen deorum. diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml index 0a674458..049b4ac9 100644 --- a/layouts/_default/sitemap.xml +++ b/layouts/_default/sitemap.xml @@ -1,10 +1,9 @@ {{ printf "" | safeHTML }}