From 1643b7ffc70887868825304355b2af9ebf59dd4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sun, 8 Jan 2023 21:18:05 +0000 Subject: [PATCH] :recycle: heroStyle in front-matter --- exampleSite/content/docs/front-matter/index.md | 4 ++-- layouts/_default/single.html | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/exampleSite/content/docs/front-matter/index.md b/exampleSite/content/docs/front-matter/index.md index 71d8687e..44503612 100644 --- a/exampleSite/content/docs/front-matter/index.md +++ b/exampleSite/content/docs/front-matter/index.md @@ -29,7 +29,7 @@ Front matter parameter default values are inherited from the theme's [base confi | `authors` | _Not set_ | Array of values for authors, if set it overrides `showAuthor` settings for page or site. Used on the multiple authors feature, check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature. | | `showAuthorsBadges` | `article.showAuthorsBadges` | Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature. | | `showHero` | `article.showHero` | Whether the thumbnail image will be shown as a hero image within the article page. | -| `heroStyle` | `article.heroStyle` | Style to display the hero image, valid options are: `basic`, `big`, `background`. | +| `heroStyle` | `article.heroStyle` | Style to display the hero image, valid options are: `basic`, `big`, `background`, `thumbAndBackground`. | | `showBreadcrumbs` | `article.showBreadcrumbs` or `list.showBreadcrumbs` | Whether the breadcrumbs are displayed in the article or list header. | | `showDate` | `article.showDate` | Whether or not the article date is displayed. The date is set using the `date` parameter. | | `showDateUpdated` | `article.showDateUpdated` | Whether or not the date the article was updated is displayed. The date is set using the `lastmod` parameter. | @@ -50,6 +50,6 @@ Front matter parameter default values are inherited from the theme's [base confi | `series_order` | _Not set_ | Number of the article within the series. | | `summary` | Auto generated using `summaryLength` (see [site configuration]({{< ref "configuration#site-configuration" >}})) | When `showSummary` is enabled, this is the Markdown string to be used as the summary for this article. | | `xml` | `true` unless excluded by `sitemap.excludedKinds` | Whether or not this article is included in the generated `/sitemap.xml` file. | -| `layoutBackgroundBlur` | `true` | Makes the background image in the background heroStyle blur with the scroll | +| `layoutBackgroundBlur` | `true` | Makes the background image in the background heroStyle blur with the scroll | | `layoutBackgroundHeaderSpace` | `true` | Add space between the header and the body. | diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0b818b5e..5811dcaa 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -3,17 +3,15 @@
{{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }} - {{ $heroStyle := .Site.Params.article.heroStyle }} - {{ if .Params.heroStyle }} - {{ $heroStyle = .Params.heroStyle }} + {{ $heroStyle := .Params.heroStyle }} + {{ if not $heroStyle }}{{ $heroStyle = .Site.Params.article.heroStyle }}{{ end }} + {{ $heroStyle := print "partials/hero/" $heroStyle ".html" }} + {{ if templates.Exists $heroStyle }} + {{ partial $heroStyle . }} + {{ else }} + {{ partial "partials/hero/basic.html" . }} + {{ end }} {{ end }} - {{ $heroStyle := print "partials/hero/" $heroStyle ".html" }} - {{ if templates.Exists $heroStyle }} - {{ partial $heroStyle . }} - {{ else }} - {{ partial "partials/hero/basic.html" . }} - {{ end }} - {{- end -}}
{{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }}