From 090fd09ccf82e80cdb475568546a951c3e4a3500 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?=
<40151420+ldericher@users.noreply.github.com>
Date: Thu, 8 Aug 2024 01:36:30 +0200
Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20add=20parameter=20backgroundIma?=
=?UTF-8?q?geWidth=20+=20english=20documentation?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/_default/params.toml | 1 +
exampleSite/content/docs/configuration/index.md | 1 +
layouts/partials/hero/background.html | 2 +-
layouts/partials/hero/basic.html | 2 +-
layouts/partials/hero/big.html | 2 +-
layouts/partials/hero/thumbAndBackground.html | 4 ++--
6 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/config/_default/params.toml b/config/_default/params.toml
index fc4edcb2..09a62b7a 100644
--- a/config/_default/params.toml
+++ b/config/_default/params.toml
@@ -17,6 +17,7 @@ enableCodeCopy = false
disableImageOptimization = false
disableTextInHeader = false
+# backgroundImageWidth = 1200
# defaultBackgroundImage = "IMAGE.jpg" # used as default for background images
# defaultFeaturedImage = "IMAGE.jpg" # used as default for featured images in all articles
diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md
index 7b3ce190..6ccb68a8 100644
--- a/exampleSite/content/docs/configuration/index.md
+++ b/exampleSite/content/docs/configuration/index.md
@@ -176,6 +176,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
| `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. |
| `disableImageZoom` | `false` | Disables image zoom feature across all the images in the site. |
| `disableImageOptimization` | `false` | Disables image resize and optimization features across all the images in the site. |
+| `backgroundImageWidth` | `1200` | Width (in pixels) to scale background images to. |
| `disableTextInHeader` | `false` | Disables text in header, useful for logo based headers. |
| `defaultBackgroundImage` | _Not set_ | Default background image for both `background` homepage layout and `background` hero style |
| `defaultFeaturedImage` | _Not set_ | Default background image for all `featured` images across articles, will be overridden by a local `featured` image. |
diff --git a/layouts/partials/hero/background.html b/layouts/partials/hero/background.html
index 1f6e3fb3..2cf1d6ea 100644
--- a/layouts/partials/hero/background.html
+++ b/layouts/partials/hero/background.html
@@ -41,7 +41,7 @@
style="background-image:url({{ .RelPermalink }});">
{{ end }}
{{ else }}
- {{ with .Resize "1200x" }}
+ {{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
{{ end }}
diff --git a/layouts/partials/hero/basic.html b/layouts/partials/hero/basic.html
index 4d01bb23..87ec4f14 100644
--- a/layouts/partials/hero/basic.html
+++ b/layouts/partials/hero/basic.html
@@ -26,7 +26,7 @@
{{ end }}
{{ else }}
- {{ with .Resize "1200x" }}
+ {{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
{{ end }}
{{ end }}
diff --git a/layouts/partials/hero/big.html b/layouts/partials/hero/big.html
index 4b61b833..30562f2d 100644
--- a/layouts/partials/hero/big.html
+++ b/layouts/partials/hero/big.html
@@ -48,7 +48,7 @@
{{ end }}
{{ else }}
- {{ with .Resize "1200x" }}
+ {{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
{{ if $caption }}
diff --git a/layouts/partials/hero/thumbAndBackground.html b/layouts/partials/hero/thumbAndBackground.html
index 4b807ac1..bc9882c1 100644
--- a/layouts/partials/hero/thumbAndBackground.html
+++ b/layouts/partials/hero/thumbAndBackground.html
@@ -25,7 +25,7 @@
{{ end }}
{{ else }}
-{{ with .Resize "1200x" }}
+{{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
{{ end }}
{{ end }}
@@ -44,7 +44,7 @@
{{ end }}
{{ else }}
-{{ with .Resize "1200x" }}
+{{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
From eebadb405fea0831f8295d3f7c5de668599655b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?=
<40151420+ldericher@users.noreply.github.com>
Date: Thu, 8 Aug 2024 01:54:47 +0200
Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8=20add=20parameter=20author.imageQ?=
=?UTF-8?q?uality=20+=20english=20documentation?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/_default/languages.en.toml | 1 +
exampleSite/content/docs/configuration/index.md | 15 ++++++++-------
layouts/partials/home/background.html | 2 +-
layouts/partials/home/hero.html | 2 +-
layouts/partials/home/profile.html | 2 +-
5 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/config/_default/languages.en.toml b/config/_default/languages.en.toml
index e334ec9a..5e7cae34 100644
--- a/config/_default/languages.en.toml
+++ b/config/_default/languages.en.toml
@@ -16,6 +16,7 @@ title = "Blowfish"
# [author]
# name = "Your name here"
# image = "img/blowfish_logo.png"
+# imageQuality = 96
# headline = "I'm only human"
# bio = "A little bit about you"
# links = [
diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md
index 6ccb68a8..00dbaa2c 100644
--- a/exampleSite/content/docs/configuration/index.md
+++ b/exampleSite/content/docs/configuration/index.md
@@ -136,13 +136,14 @@ The default file can be used as a template to create additional languages, or re
#### Author
-| Name | Default | Description |
-| ----------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `author.name` | _Not set_ | The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used. |
-| `author.image` | _Not set_ | Path to the image file of the author. The image should be a 1:1 aspect ratio. The image can be placed in the site's `assets/` folder or can be external url. |
-| `author.headline` | _Not set_ | A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name. |
-| `author.bio` | _Not set_ | A Markdown string containing the author's bio. It will be displayed in article footers. |
-| `author.links` | _Not set_ | The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`. |
+| Name | Default | Description |
+| --------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `author.name` | _Not set_ | The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used. |
+| `author.image` | _Not set_ | Path to the image file of the author. The image should be a 1:1 aspect ratio. The image can be placed in the site's `assets/` folder or can be external url. |
+| `author.imageQuality` | `96` | The author's image file will be treated as a "high quality" image to minimize artifacts on the front page. Value range 1-100. |
+| `author.headline` | _Not set_ | A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name. |
+| `author.bio` | _Not set_ | A Markdown string containing the author's bio. It will be displayed in article footers. |
+| `author.links` | _Not set_ | The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`. |
### Menus
diff --git a/layouts/partials/home/background.html b/layouts/partials/home/background.html
index 2746eea9..d1cfa9ba 100644
--- a/layouts/partials/home/background.html
+++ b/layouts/partials/home/background.html
@@ -40,7 +40,7 @@
{{ end }}
{{ if $authorImage }}
{{ if not $disableImageOptimization }}
- {{ $authorImage = $authorImage.Fill "288x288" }}
+ {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Author.imagequality | default "96" )) }}
{{ end }}
diff --git a/layouts/partials/home/hero.html b/layouts/partials/home/hero.html
index 7a0a5119..50a64fad 100644
--- a/layouts/partials/home/hero.html
+++ b/layouts/partials/home/hero.html
@@ -37,7 +37,7 @@
{{ end }}
{{ if $authorImage }}
{{ if not $disableImageOptimization }}
- {{ $authorImage = $authorImage.Fill "288x288" }}
+ {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Author.imagequality | default "96" )) }}
{{ end }}
diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html
index 09e8adaf..93732ea0 100644
--- a/layouts/partials/home/profile.html
+++ b/layouts/partials/home/profile.html
@@ -12,7 +12,7 @@
{{ end }}
{{ if $authorImage }}
{{ if not $disableImageOptimization }}
- {{ $authorImage = $authorImage.Fill "288x288" }}
+ {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Author.imagequality | default "96" )) }}
{{ end }}
From b772b5ed97be898308a28a230bc4430939023d13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?=
<40151420+ldericher@users.noreply.github.com>
Date: Thu, 8 Aug 2024 02:00:47 +0200
Subject: [PATCH 3/3] parameter backgroundImageWidth `default` function usage
---
layouts/partials/hero/background.html | 2 +-
layouts/partials/hero/basic.html | 2 +-
layouts/partials/hero/big.html | 2 +-
layouts/partials/hero/thumbAndBackground.html | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/layouts/partials/hero/background.html b/layouts/partials/hero/background.html
index 2cf1d6ea..66799507 100644
--- a/layouts/partials/hero/background.html
+++ b/layouts/partials/hero/background.html
@@ -41,7 +41,7 @@
style="background-image:url({{ .RelPermalink }});">
{{ end }}
{{ else }}
- {{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
+ {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
{{ end }}
diff --git a/layouts/partials/hero/basic.html b/layouts/partials/hero/basic.html
index 87ec4f14..f1928003 100644
--- a/layouts/partials/hero/basic.html
+++ b/layouts/partials/hero/basic.html
@@ -26,7 +26,7 @@
{{ end }}
{{ else }}
- {{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
+ {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
{{ end }}
{{ end }}
diff --git a/layouts/partials/hero/big.html b/layouts/partials/hero/big.html
index 30562f2d..60e59772 100644
--- a/layouts/partials/hero/big.html
+++ b/layouts/partials/hero/big.html
@@ -48,7 +48,7 @@
{{ end }}
{{ else }}
- {{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
+ {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
{{ if $caption }}
diff --git a/layouts/partials/hero/thumbAndBackground.html b/layouts/partials/hero/thumbAndBackground.html
index bc9882c1..5f974c4e 100644
--- a/layouts/partials/hero/thumbAndBackground.html
+++ b/layouts/partials/hero/thumbAndBackground.html
@@ -25,7 +25,7 @@
{{ end }}
{{ else }}
-{{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
+{{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
{{ end }}
{{ end }}
@@ -44,7 +44,7 @@
{{ end }}
{{ else }}
-{{ with .Resize (print (default "1200" $.Site.Params.backgroundImageWidth) "x") }}
+{{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}