Properly implement layoutBackgroundBlur and layoutBackgroundHeaderSpace in term and taxonomy

This commit is contained in:
MaikelChan
2026-03-23 08:00:37 +01:00
parent ef712c33f9
commit a0fc381ba9
6 changed files with 24 additions and 10 deletions
+4
View File
@@ -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
@@ -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. |
+1 -1
View File
@@ -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" }}
+1 -1
View File
@@ -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" }}
+9 -5
View File
@@ -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"))
)
}}
@@ -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"))
)
}}