Add front matter for various display options

pull/2/head
James Panther 2021-08-15 11:21:37 +10:00
parent 73218ce192
commit 491d356d15
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
6 changed files with 27 additions and 19 deletions

View File

@ -190,26 +190,40 @@ When you create a new taxonomy, you will need to adjust the navigation links on
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.
Many of the article defaults here can be overridden on a per article basis by specifying it in the front matter. Refer to the [front matter docs](#front-matter) below for further details.
<!-- prettier-ignore-start -->
|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.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.showReadingTime`|boolean|`true`|Whether or not article reading times are displayed.|
|`article.showHeadingAnchors`|boolean|`true`|Whether or not heading anchor links are displayed alongside headings within articles.|
|`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.|
|`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.|
|`verification.google`|string|_Not set_|The site verification string provided by Google to be included in the site metadata.|
|`verification.bing`|string|_Not set_|The site verification string provided by Bing to be included in the site metadata.|
|`verification.pinterest`|string|_Not set_|The site verification string provided by Pinterest to be included in the site metadata.|
|`verification.yandex`|string|_Not set_|The site verification string provided by Yandex to be included in the site metadata.|
|`fathomAnalytics.site`|string|_Not set_|The site code generated by Fathom Analytics for the website. Refer to the [Analytics docs](#analyticshtml) below for more details.|
|`fathomAnalytics.domain`|string|_Not set_|If using a custom domain with Fathom Analytics, provide it here to serve `script.js` from the custom domain.|
<!-- prettier-ignore-end -->
## 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.
In addition to the [default Hugo front matter parameters](https://gohugo.io/content-management/front-matter/#front-matter-variables), Congo adds a number of additional options to customise the presentation of individual articles. All the available theme parameters are listed below.
Front matter parameter default values are inherited from the [base theme config](#parameters) above, so you only need to specify these parameters in your front matter when you want to override the default.
<!-- prettier-ignore-start -->
|Name|Type|Default|Description|
| --- | --- | --- | --- |
|`xml`|boolean|`true`|Whether or not this article is included in the generated sitemap.xml file.|
|`showHeadingAnchors`|boolean|`article.showHeadingAnchors`|Whether or not heading anchor links are displayed alongside headings within this article.|
|`showAuthor`|boolean|`article.showAuthor`|Whether or not the author box is displayed in the article footer.|
|`showPagination`|boolean|`article.showPagination`|Whether or not the next/previous article links are displayed in the article footer.|
|`xml`|boolean|`true` unless excluded by `sitemap.excludedKinds`|Whether or not this article is included in the generated `/sitemap.xml` file.|
<!-- prettier-ignore-end -->
## Shortcodes

View File

@ -1,11 +1,14 @@
# -- Theme Options --
# These options control how the theme functions and allow you to
# customise the display of your website.
#
# Refer to the README for more details about each of these parameters.
[article]
showDate = true
dateFormat = "2 January 2006"
showReadingTime = true
showHeadingAnchors = true
showAuthor = true
showPagination = true
@ -15,21 +18,12 @@
[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 <head>.
[verification]
# google = ""
# bing = ""
# pinterest = ""
# yandex = ""
# -- Fathom Analytics --
# To enable Fathom Analytics on your site, specify your site code below.
# If you also use a custom domain with Fathom, you can add it at `domain`.
[fathomAnalytics]
# site = "ABC12345"
# domain = "llama.yoursite.com"

View File

@ -1 +1 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} <a class="heading-anchor" href="#{{ .Anchor | safeURL }}" aria-label="Anchor">#</a></h{{ .Level }}>
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} {{ if .Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }}<a class="heading-anchor" href="#{{ .Anchor | safeURL }}" aria-label="Anchor">#</a>{{ end }}</h{{ .Level }}>

View File

@ -17,7 +17,7 @@
{{ .Content | emojify }}
</section>
<footer>
{{ partialCached "author.html" . }}
{{ partial "author.html" . }}
{{ partial "article-pagination.html" . }}
</footer>
{{/* Comments */}}

View File

@ -1,4 +1,4 @@
{{ if .Site.Params.article.showPagination | default true }}
{{ if .Params.showPagination | default (.Site.Params.article.showPagination | default true) }}
{{ if or .NextInSection .PrevInSection }}
<div class="pt-8">
<hr class="border-gray-300 border-dotted dark:border-gray-600" />

View File

@ -1,4 +1,4 @@
{{ if .Site.Params.article.showAuthor | default true }}
{{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
<div class="flex items-center pt-8">
{{ with .Site.Author.image }}
<img class="w-24 h-24 !mt-0 !mb-0 mr-4 rounded-full" src="{{ . }}" />