From a0fc381ba902710b71adf08347ab34f0a89e544d Mon Sep 17 00:00:00 2001 From: MaikelChan Date: Mon, 23 Mar 2026 08:00:37 +0100 Subject: [PATCH] Properly implement layoutBackgroundBlur and layoutBackgroundHeaderSpace in term and taxonomy --- config/_default/params.toml | 4 ++++ exampleSite/content/docs/configuration/index.md | 4 ++++ layouts/_default/term.html | 2 +- layouts/_default/terms.html | 2 +- layouts/partials/hero/background.html | 14 +++++++++----- layouts/partials/hero/thumbAndBackground.html | 8 +++++--- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index 8b0bf26a..068209ed 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -119,6 +119,8 @@ forgejoDefaultServer = "https://v11.next.forgejo.org" showTermCount = true showHero = false # heroStyle = "background" # valid options: basic, big, background, thumbAndBackground + layoutBackgroundBlur = true # only used when heroStyle equals background or thumbAndBackground + layoutBackgroundHeaderSpace = true # only used when heroStyle equals background showBreadcrumbs = false showViews = false showLikes = false @@ -128,6 +130,8 @@ forgejoDefaultServer = "https://v11.next.forgejo.org" [term] showHero = false # heroStyle = "background" # valid options: basic, big, background, thumbAndBackground + layoutBackgroundBlur = true # only used when heroStyle equals background or thumbAndBackground + layoutBackgroundHeaderSpace = true # only used when heroStyle equals background showBreadcrumbs = false showViews = false showLikes = false diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 9e733bb8..9f5d5cdd 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -303,6 +303,8 @@ Many of the article defaults here can be overridden on a per article basis by sp | `taxonomy.showHero` | `false` | Whether the thumbnail image will be shown as a hero image within each taxonomy page. | | `taxonomy.heroStyle` | _Not set_ | Style to display the hero image, valid options are: `basic`, `big`, `background`, `thumbAndBackground`. Effective only if `taxonomy.showHero = true`. | | `taxonomy.showBreadcrumbs` | `false` | Whether or not breadcrumbs are displayed in the taxonomy header. | +| `taxonomy.layoutBackgroundBlur` | `true` | Makes the background image in the background taxonomy heroStyle blur with the scroll | +| `taxonomy.layoutBackgroundHeaderSpace` | `true` | Add space between the header and the body. | | `taxonomy.showViews` | `false` | Whether or not article views are displayed. This requires firebase integrations to be enabled, look below. | | `taxonomy.showLikes` | `false` | Whether or not article likes are displayed. This requires firebase integrations to be enabled, look below. | | `taxonomy.showTableOfContents` | `false` | Whether or not the table of contents is displayed on taxonomies. | @@ -315,6 +317,8 @@ Many of the article defaults here can be overridden on a per article basis by sp | `term.showHero` | `false` | Whether the thumbnail image will be shown as a hero image within each term page. | | `term.heroStyle` | _Not set_ | Style to display the hero image, valid options are: `basic`, `big`, `background`, `thumbAndBackground`. Effective only if `term.showHero = true`. | | `term.showBreadcrumbs` | `false` | Whether or not breadcrumbs are displayed in the term header. | +| `term.layoutBackgroundBlur` | `true` | Makes the background image in the background term heroStyle blur with the scroll | +| `term.layoutBackgroundHeaderSpace` | `true` | Add space between the header and the body. | | `term.showViews` | `false` | Whether or not article views are displayed. This requires firebase integrations to be enabled, look below. | | `term.showLikes` | `false` | Whether or not article likes are displayed. This requires firebase integrations to be enabled, look below. | | `term.showTableOfContents` | `false` | Whether or not the table of contents is displayed on terms. | diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 2432ec6b..84d7d7cd 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -1,5 +1,5 @@ {{ define "main" }} - {{ .Scratch.Set "scope" "list" }} + {{ .Scratch.Set "scope" "term" }} {{ $showHero := .Params.showHero | default site.Params.term.showHero | default false }} {{ if $showHero }} {{ $heroStyle := print "hero/" site.Params.term.heroStyle ".html" }} diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index 664d2bec..f34cee1b 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -1,5 +1,5 @@ {{ define "main" }} - {{ .Scratch.Set "scope" "list" }} + {{ .Scratch.Set "scope" "terms" }} {{ $showHero := .Params.showHero | default site.Params.taxonomy.showHero | default false }} {{ if $showHero }} {{ $heroStyle := print "hero/" site.Params.taxonomy.heroStyle ".html" }} diff --git a/layouts/partials/hero/background.html b/layouts/partials/hero/background.html index 8f1f568d..ca5b4094 100644 --- a/layouts/partials/hero/background.html +++ b/layouts/partials/hero/background.html @@ -44,15 +44,19 @@ {{ end }} {{ end }} -{{ $isParentList := eq (.Scratch.Get "scope") "list" }} +{{ $scope := .Scratch.Get "scope" }} {{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or - (and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList)) - (and ($.Site.Params.list.layoutBackgroundBlur | default true) ($isParentList)) + (and ($.Site.Params.article.layoutBackgroundBlur | default true) (eq $scope "single")) + (and ($.Site.Params.list.layoutBackgroundBlur | default true) (eq $scope "list")) + (and ($.Site.Params.taxonomy.layoutBackgroundBlur | default true) (eq $scope "terms")) + (and ($.Site.Params.term.layoutBackgroundBlur | default true) (eq $scope "term")) ) }} {{ $shouldAddHeaderSpace := $.Params.layoutBackgroundHeaderSpace | default (or - (and ($.Site.Params.article.layoutBackgroundHeaderSpace | default true) (not $isParentList)) - (and ($.Site.Params.list.layoutBackgroundHeaderSpace | default true) ($isParentList)) + (and ($.Site.Params.article.layoutBackgroundHeaderSpace | default true) (eq $scope "single")) + (and ($.Site.Params.list.layoutBackgroundHeaderSpace | default true) (eq $scope "list")) + (and ($.Site.Params.taxonomy.layoutBackgroundHeaderSpace | default true) (eq $scope "terms")) + (and ($.Site.Params.term.layoutBackgroundHeaderSpace | default true) (eq $scope "term")) ) }} diff --git a/layouts/partials/hero/thumbAndBackground.html b/layouts/partials/hero/thumbAndBackground.html index 8d073386..3baf1d65 100644 --- a/layouts/partials/hero/thumbAndBackground.html +++ b/layouts/partials/hero/thumbAndBackground.html @@ -76,10 +76,12 @@ {{ end }} {{ end }} -{{ $isParentList := eq (.Scratch.Get "scope") "list" }} +{{ $scope := .Scratch.Get "scope" }} {{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or - (and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList)) - (and ($.Site.Params.list.layoutBackgroundBlur | default true) ($isParentList)) + (and ($.Site.Params.article.layoutBackgroundBlur | default true) (eq $scope "single")) + (and ($.Site.Params.list.layoutBackgroundBlur | default true) (eq $scope "list")) + (and ($.Site.Params.taxonomy.layoutBackgroundBlur | default true) (eq $scope "terms")) + (and ($.Site.Params.term.layoutBackgroundBlur | default true) (eq $scope "term")) ) }}