Add theme parameters to customise site footer

pull/231/head
James Panther 2022-06-25 12:42:02 +10:00
parent 971e8b631d
commit 31c7cca31d
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
5 changed files with 26 additions and 14 deletions

View File

@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased]
### Added
- `showCopyright` and `showThemeAttribution` parameters that allow more control over how the site footer is displayed
### Changed
- Search will now return results for all page types, including lists and taxonomies

View File

@ -9,13 +9,15 @@ colorScheme = "congo"
defaultAppearance = "light" # valid options: light or dark
autoSwitchAppearance = true
showAppearanceSwitcher = false
showCopyright = true
showThemeAttribution = true
showScrollToTop = true
enableSearch = false
enableCodeCopy = false
# mainSections = ["section1", "section2"]
# robots = ""
showScrollToTop = true
[homepage]
layout = "page" # valid options: page, profile, custom

View File

@ -9,13 +9,15 @@ colorScheme = "congo"
defaultAppearance = "light" # valid options: light or dark
autoSwitchAppearance = true
showAppearanceSwitcher = true
showCopyright = true
showThemeAttribution = true
showScrollToTop = true
enableSearch = true
enableCodeCopy = true
mainSections = ["samples"]
# robots = ""
showScrollToTop = true
[homepage]
layout = "custom" # valid options: page, profile, custom

View File

@ -117,12 +117,14 @@ Many of the article defaults here can be overridden on a per article basis by sp
|`defaultAppearance`|`"light"`|The default theme appearance, either `light` or `dark`.|
|`autoSwitchAppearance`|`true`|Whether the theme appearance automatically switches based upon the visitor's operating system preference. Set to `false` to force the site to always use the `defaultAppearance`.|
|`showAppearanceSwitcher`|`false`|Whether or not to show the appearance switcher in the site footer. The browser's local storage is used to persist the visitor's preference.|
|`showCopyright`|`true`|Whether or not to show the copyright string in the site footer. Note that the string itself can be customised using the `copyright` parameter in the [languages configuration](#language-and-i18n).|
|`showThemeAttribution`|`true`|Whether or not to show the "powered by" theme attribution in the site footer. If you choose to disable this message, please consider attributing the theme somewhere else on your site (for example, on your about page).|
|`showScrollToTop`|`true`|When set to `true` the scroll to top arrow is displayed.|
|`enableSearch`|`false`|Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#site-configuration) being set correctly.|
|`enableCodeCopy`|`false`|Whether copy-to-clipboard buttons are enabled for `<code>` blocks. The `highlight.noClasses` parameter must be set to `false` for code copy to function correctly. Read more about [other configuration files](#other-configuration-files) below.|
|`logo`|_Not set_|The relative path to the site logo file within the `assets/` folder. The logo file should be provided at 2x resolution and supports any image dimensions.|
|`mainSections`|_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`|_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.|
|`showScrollToTop`|`true`|When set to `true` the scroll to top arrow is displayed.|
|`homepage.layout`|`"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`|`false`|Whether or not to display the recent articles list on the homepage.|
|`article.showDate`|`true`|Whether or not article dates are displayed.|

View File

@ -18,9 +18,10 @@
</ul>
</nav>
{{ end }}
<div class="flex justify-between">
<div class="flex items-center justify-between">
<div>
{{/* Copyright */}}
{{ if .Site.Params.showCopyright | default true }}
<p class="text-sm text-neutral-500 dark:text-neutral-400">
{{- with .Site.Params.copyright }}
{{ . | emojify | markdownify }}
@ -30,8 +31,9 @@
{{ .Site.Author.name | markdownify | emojify }}
{{- end }}
</p>
{{ end }}
{{/* Theme attribution */}}
{{ if .Site.Params.attribution | default true }}
{{ if .Site.Params.showThemeAttribution | default true }}
<p class="text-xs text-neutral-500 dark:text-neutral-400">
{{ $hugo := printf `<a class="hover:underline hover:decoration-primary-400 hover:text-primary-500"
href="https://gohugo.io/" target="_blank" rel="noopener noreferrer">Hugo</a>`