diff --git a/config/_default/params.toml b/config/_default/params.toml index bad1d72c..641c6c1c 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -45,6 +45,7 @@ enableCodeCopy = true showHero = true heroStyle = "basic" # valid options: basic, big, background layoutBackgroundBlur = false # only used when heroStyle equals background + layoutBackgroundHeaderSpace = true # only used when heroStyle equals background showBreadcrumbs = true showDraftLabel = true showEdit = true @@ -65,6 +66,7 @@ enableCodeCopy = true [list] #showHero = true #heroStyle = "background" # valid options: basic, big, background + #layoutBackgroundHeaderSpace = true # only used when heroStyle equals background showBreadcrumbs = false showSummary = false #showViews = true diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 717cd5b5..532ab37a 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -161,6 +161,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `article.showHero` | `false` | Whether the thumbnail image will be shown as a hero image within each article page. | | `article.heroStyle` | _Not set_ | Style to display the hero image, valid options are: `basic`, `big`, `background`. | | `article.layoutBackgroundBlur` | `false` | Makes the background image in the background article heroStyle blur with the scroll | +| `article.layoutBackgroundHeaderSpace` | `true` | Add space between the header and the body. | | `article.showBreadcrumbs` | `false` | Whether or not breadcrumbs are displayed in the article header. | | `article.showDraftLabel` | `true` | Whether or not the draft indicator is shown next to articles when site is built with `--buildDrafts`. | | `article.showEdit` | `false` | Whether or not the link to edit the article content should be displayed. | @@ -180,6 +181,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `list.showHero` | `false` | Whether the thumbnail image will be shown as a hero image within each list page. | | `list.heroStyle` | _Not set_ | Style to display the hero image, valid options are: `basic`, `big`, `background`. | | `list.showBreadcrumbs` | `false` | Whether or not breadcrumbs are displayed in the header on list pages. | +| `list.layoutBackgroundHeaderSpace` | `true` | Add space between the header and the body. | | `list.showTableOfContents` | `false` | Whether or not the table of contents is displayed on list pages. | | `list.showSummary` | `false` | Whether or not article summaries are displayed on list pages. If a summary is not provided in the [front matter]({{< ref "front-matter" >}}), one will be auto generated using the `summaryLength` parameter in the [site configuration](#site-configuration). | | `list.showViews` | `false` | Whether or not list views are displayed. This requires firebase integrations to be enabled, look below. | diff --git a/exampleSite/content/docs/front-matter/index.md b/exampleSite/content/docs/front-matter/index.md index d4392e4c..338e2404 100644 --- a/exampleSite/content/docs/front-matter/index.md +++ b/exampleSite/content/docs/front-matter/index.md @@ -50,4 +50,5 @@ 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.| +|`layoutBackgroundHeaderSpace`|`true`|Add space between the header and the body.| diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 4ba6f614..05a88421 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,5 +1,6 @@ {{ define "main" }} +{{ .Scratch.Set "scope" "list" }} {{ if .Site.Params.list.showHero | default false }} {{ $heroStyle := print "partials/hero/" .Site.Params.list.heroStyle ".html" }} {{ if templates.Exists $heroStyle }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index adf1d7a3..c5a1a0d6 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,4 +1,6 @@ {{ define "main" }} +{{ .Scratch.Set "scope" "single" }} +
{{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }} {{ $heroStyle := print "partials/hero/" .Site.Params.article.heroStyle ".html" }} diff --git a/layouts/partials/hero/background.html b/layouts/partials/hero/background.html index 01893a07..7c03ccc2 100644 --- a/layouts/partials/hero/background.html +++ b/layouts/partials/hero/background.html @@ -2,9 +2,16 @@ {{- $featured := $images.GetMatch "*feature*" -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ with .Site.Params.defaultBackgroundImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} +{{ $isParentList := eq (.Scratch.Get "scope") "list" }} +{{ $shouldAddHeaderSpace := $.Params.layoutBackgroundHeaderSpace | default (or + (and ($.Site.Params.article.layoutBackgroundHeaderSpace | default true) (not $isParentList)) + (and ($.Site.Params.list.layoutBackgroundHeaderSpace | default true) ($isParentList)) + ) }} {{- with $featured -}} {{ with .Resize "1200x" }} +{{ if $shouldAddHeaderSpace | default true}}
+{{ end }}