diff --git a/assets/sass/main.scss b/assets/sass/main.scss index 96655b0..f919b82 100644 --- a/assets/sass/main.scss +++ b/assets/sass/main.scss @@ -1678,4 +1678,7 @@ } +{{ with (index ( index .Site.Data .Site.Language.Lang | default .Site.Data ) "homepage" "header" "image") -}} + $header-image: "{{- . -}}"; +{{- end }} @import 'custom.scss'; diff --git a/layouts/_default/list.html b/layouts/_default/list.html index fec6ecf..faf9ed1 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,17 +1,50 @@ {{ define "main" }} -
-

{{ .Title }}

- {{ with .Description -}} -

{{ . }}

- {{- end }} -
- - {{- if .Params.image }} - {{ .Params.image_alt }} +
+

{{ .Title }}

+ {{ with .Description }} +

{{ . }}

{{ end }} +
- {{ range .RegularPages }} - {{ .Render "shortblock" }} - {{ end }} + {{- if .Params.image }} + {{- $alt := .Params.image_alt | default .Title -}} + {{- with $img := resources.Get .Params.image }} + {{ $image_options := $.Site.Params.image_options | default "webp q85 lanczos photo" }} + + {{- $breakpoints := slice 1920 1600 1366 900 600 360 -}} + {{- range $bp := $breakpoints }} + {{- if le $bp .Width }} + {{- with .Resize (printf "%dx %s" $bp $image_options) }} + + {{- end }} + {{- end }} + {{- end }} + + {{- /* Fallback: full-sized optimized image */ -}} + {{- with .Resize (printf "%dx %s" .Width $image_options) }} + {{ $alt }} + {{- end }} + + {{- else }} + + {{ $alt }} + + {{- end }} + {{ end }} + {{ range .RegularPages }} + {{ .Render "shortblock" }} + {{ end }} {{ end }} diff --git a/layouts/_default/shortblock.html b/layouts/_default/shortblock.html index f85b0fb..2a3adac 100644 --- a/layouts/_default/shortblock.html +++ b/layouts/_default/shortblock.html @@ -1,18 +1,55 @@
-
- {{ .Params.image_alt }} -
-

{{ .Title }}

- {{ if .Site.Params.show_post_dates | default true }} - {{- with .Date }}{{ end }} - {{ end }} -

- {{ with .Description }} - {{- . }} - {{- else }} - {{- .Summary }} - {{- end }} -

-
+
+ + {{- $alt := .Params.image_alt | default .Title -}} + {{- with $img := resources.Get .Params.image }} + {{ $image_options := $.Site.Params.image_options | default "webp q85 lanczos photo" }} + {{- $breakpoints := slice 800 600 400 300 -}} + {{- $orig := $img -}} + + + {{- range $bp := $breakpoints }} + {{- if le $bp $orig.Width }} + {{- with $orig.Resize (printf "%dx %s" $bp $image_options) }} + + {{- end }} + {{- end }} + {{- end }} + + {{- /* Fallback main image (max 800px) */ -}} + {{- with $orig.Resize (printf "800x %s" $image_options) }} + {{ $alt }} + {{- end }} + + {{- else }} + {{ $alt }} + {{- end }} + + +
+

{{ .Title }}

+ {{ if .Site.Params.show_post_dates | default true }} + {{- with .Date }}{{ end }} + {{ end }} +

+ {{ with .Description }} + {{- . }} + {{- else }} + {{- .Summary }} + {{- end }} +

+
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1a60c49..ed11b85 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,8 +8,28 @@

{{ .Title }}

{{ partial "tags.html" . }} - {{- if .Params.image }} - {{ .Params.image_alt }} + {{- if .Params.image -}} + + {{- $alt := .Title -}} + {{- $img := resources.Get .Params.image -}} + {{- with $img -}} + {{ $image_options := $.Site.Params.image_options | default "webp q85 lanczos photo" -}} + + {{ range $width := slice 1920 1600 1366 900 600 360 }} + {{ if le $width $img.Width }} + {{- with $img.Resize ( printf "%dx %s" $width $image_options ) }} + + {{- end }} + {{- end }} + {{- end }} + {{- with $img.Resize ( printf "%dx%d %s" $img.Width $img.Height $image_options ) -}} + {{ $alt }} + {{- end -}} + + {{- else -}} + {{ .Params.image_alt }} + {{- end -}} + {{ end }} {{- .Content }} diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html index bfaa21c..7febd73 100644 --- a/layouts/partials/head/head.html +++ b/layouts/partials/head/head.html @@ -2,7 +2,7 @@ {{ $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "main.scss" . | css.Sass $options }} {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end }} - + {{- partial "analytics/google-tag-manager/head.html" . -}} {{- partial "head/custom.html" . -}} diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 381dc64..9141324 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -1,6 +1,11 @@ - - - - - - +{{- $js := slice + (resources.Get "js/jquery.min.js") + (resources.Get "js/jquery.dropotron.min.js") + (resources.Get "js/browser.min.js") + (resources.Get "js/breakpoints.min.js") + (resources.Get "js/util.js") + (resources.Get "js/main.js") +-}} + +{{- $bundle := $js | resources.Concat "js/bundle.js" | resources.Minify | resources.Fingerprint -}} + diff --git a/static/css/font-source-sans-pro.css b/static/css/font-source-sans-pro.css index c15f5ef..f59fa7e 100644 --- a/static/css/font-source-sans-pro.css +++ b/static/css/font-source-sans-pro.css @@ -2,27 +2,27 @@ font-family:"Source Sans Pro"; font-style:normal; font-weight:300; - font-display:auto; + font-display:swap; src:url(../webfonts/SourceSansPro-Light.ttf); } @font-face{ font-family:"Source Sans Pro"; font-style:italic; font-weight:300; - font-display:auto; + font-display:swap; src:url(../webfonts/SourceSansPro-LightItalic.ttf); } @font-face{ font-family:"Source Sans Pro"; font-style:normal; font-weight:600; - font-display:auto; + font-display:swap; src:url(../webfonts/SourceSansPro-SemiBold.ttf); } @font-face{ font-family:"Source Sans Pro"; font-style:italic; font-weight:600; - font-display:auto; + font-display:swap; src:url(../webfonts/SourceSansPro-SemiBoldItalic.ttf); } \ No newline at end of file