diff options
author | Christoph Cullmann <christoph@cullmann.io> | 2024-08-28 22:54:34 +0200 |
---|---|---|
committer | Christoph Cullmann <christoph@cullmann.io> | 2024-08-28 22:54:34 +0200 |
commit | 8f3d03b1888fed23e6aa07d6077045e673357481 (patch) | |
tree | a914b8f43b8486380ccc1c35721b28da2ff7986a /themes/blowfish/layouts/partials | |
parent | 8db6bd0e555dca050d7d885582100c5ca5ba3aa2 (diff) |
Diffstat (limited to 'themes/blowfish/layouts/partials')
21 files changed, 76 insertions, 46 deletions
diff --git a/themes/blowfish/layouts/partials/analytics/main.html b/themes/blowfish/layouts/partials/analytics/main.html index 5db13e5..ab39496 100644 --- a/themes/blowfish/layouts/partials/analytics/main.html +++ b/themes/blowfish/layouts/partials/analytics/main.html @@ -6,4 +6,7 @@ {{ end }} {{ with site.Params.umamiAnalytics.websiteid }} {{ partial "analytics/umami.html" }} +{{ end }} +{{ with site.Params.selineAnalytics.token }} +{{ partial "analytics/seline.html" }} {{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/analytics/seline.html b/themes/blowfish/layouts/partials/analytics/seline.html new file mode 100644 index 0000000..955d40a --- /dev/null +++ b/themes/blowfish/layouts/partials/analytics/seline.html @@ -0,0 +1,18 @@ +<script async src="https://cdn.seline.so/seline.js" data-token="{{ site.Params.selineAnalytics.token }}" data-id="seline-script"></script> + +{{ if .Site.Params.selineAnalytics.enableTrackEvent | default true }} +<script type="text/javascript"> + document.querySelector('script[data-id="seline-script"]') + .addEventListener('load', function () { + const type = document.head.querySelector('meta[property = "og:type"]').getAttribute('content'); + let title = document.head.querySelector('meta[property = "og:title"]').getAttribute('content'); + let url = document.head.querySelector('meta[property = "og:url"]').getAttribute('content'); + + seline.track("user:" + type + ':' + title, { + type: type, + title: title, + url: url + }); + }); +</script> +{{ end }} diff --git a/themes/blowfish/layouts/partials/analytics/umami.html b/themes/blowfish/layouts/partials/analytics/umami.html index f9fb041..96b6cb2 100644 --- a/themes/blowfish/layouts/partials/analytics/umami.html +++ b/themes/blowfish/layouts/partials/analytics/umami.html @@ -10,6 +10,7 @@ </script> {{ end }} +{{ if .Site.Params.umamiAnalytics.enableTrackEvent | default true }} <script type="text/javascript"> document.querySelector('script[data-id="umami-script"]') .addEventListener('load', function () { @@ -18,4 +19,5 @@ let url = document.head.querySelector('meta[property = "og:url"]').getAttribute('content'); umami.track(type + ':' + title, {'url': url}); }); -</script>
\ No newline at end of file +</script> +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-meta/basic.html b/themes/blowfish/layouts/partials/article-meta/basic.html index 40d12d5..2bfcd25 100644 --- a/themes/blowfish/layouts/partials/article-meta/basic.html +++ b/themes/blowfish/layouts/partials/article-meta/basic.html @@ -19,7 +19,7 @@ {{ end }} {{ if and (.Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false)) (ne (partial -"functions/date.html" .Date) (partial "functions/date.html" .Lastmod)) }} +"functions/date.html" .Date) (partial "functions/date.html" .Lastmod)) (gt (.Lastmod | time.Format "2006") 1) }} {{ $meta.Add "partials" (slice (partial "meta/date-updated.html" .Lastmod)) }} {{ end }} @@ -96,4 +96,4 @@ </div> {{ end }} -{{ end }}
\ No newline at end of file +{{ end }} diff --git a/themes/blowfish/layouts/partials/author-links.html b/themes/blowfish/layouts/partials/author-links.html index 745c0d1..7ea84e6 100644 --- a/themes/blowfish/layouts/partials/author-links.html +++ b/themes/blowfish/layouts/partials/author-links.html @@ -1,4 +1,4 @@ -{{ with .Site.Author.links }} +{{ with .Site.Params.Author.links }} <div class="flex flex-wrap text-neutral-400 dark:text-neutral-500"> {{ range $links := . }} {{ range $name, $url := $links }} diff --git a/themes/blowfish/layouts/partials/author.html b/themes/blowfish/layouts/partials/author.html index 53fd9be..233f0e1 100644 --- a/themes/blowfish/layouts/partials/author.html +++ b/themes/blowfish/layouts/partials/author.html @@ -1,6 +1,6 @@ {{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} <div class="flex author"> - {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := "" }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $authorImage = resources.GetRemote . }} @@ -12,18 +12,18 @@ {{ $authorImage = $authorImage.Fill "192x192" }} {{ end }} <img class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" width="96" height="96" - alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> + alt="{{ $.Site.Params.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> {{ else }} {{ $authorImage := resources.GetRemote . }} {{ if not $disableImageOptimization }} {{ $authorImage = $authorImage.Fill "192x192" }} {{ end }} <img class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" width="96" height="96" - alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> + alt="{{ $.Site.Params.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> {{ end }} {{ end }} <div class="place-self-center"> - {{ with .Site.Author.name | markdownify }} + {{ with .Site.Params.Author.name | markdownify }} <div class="text-[0.6rem] uppercase leading-3 text-neutral-500 dark:text-neutral-400"> {{ i18n "author.byline_title" | markdownify }} </div> @@ -31,7 +31,7 @@ {{ . }} </div> {{ end }} - {{ with .Site.Author.bio | markdownify }} + {{ with .Site.Params.Author.bio | markdownify }} <div class="text-sm text-neutral-700 dark:text-neutral-400">{{ . }}</div> {{ end }} <div class="text-2xl sm:text-lg">{{ partialCached "author-links.html" . }}</div> diff --git a/themes/blowfish/layouts/partials/footer.html b/themes/blowfish/layouts/partials/footer.html index d31cecd..cce8ae9 100644 --- a/themes/blowfish/layouts/partials/footer.html +++ b/themes/blowfish/layouts/partials/footer.html @@ -31,7 +31,7 @@ {{- else }} © {{ now.Format "2006" }} - {{ .Site.Author.name | markdownify }} + {{ .Site.Params.Author.name | markdownify }} {{- end }} </p> {{ end }} diff --git a/themes/blowfish/layouts/partials/head.html b/themes/blowfish/layouts/partials/head.html index f59e9dc..a1c4b30 100644 --- a/themes/blowfish/layouts/partials/head.html +++ b/themes/blowfish/layouts/partials/head.html @@ -74,7 +74,8 @@ }}"></script> {{ end }} {{ if not .Site.Params.disableImageZoom | default true }} - <script src="{{ "js/zoom.min.js" | relURL }}"></script> + {{ $zoomJS := resources.Get "lib/zoom/zoom.min.js" | resources.Fingerprint "sha512" }} + <script src="{{ $zoomJS.RelPermalink }}" integrity="{{ $zoomJS.Data.Integrity }}"></script> {{ end }} {{/* Icons */}} {{ if templates.Exists "partials/favicons.html" }} @@ -104,9 +105,9 @@ {{/* Schema */}} {{ partial "schema.html" . }} {{/* Me */}} - {{ with .Site.Author.name }} + {{ with .Site.Params.Author.name }} <meta name="author" content="{{ . }}" />{{ end }} - {{ with .Site.Author.links }} + {{ with .Site.Params.Author.links }} {{ range $links := . }} {{ range $name, $url := $links }} <link href="{{ $url }}" rel="me" />{{ end }} diff --git a/themes/blowfish/layouts/partials/header/basic.html b/themes/blowfish/layouts/partials/header/basic.html index 6b2c6fa..caf69fa 100644 --- a/themes/blowfish/layouts/partials/header/basic.html +++ b/themes/blowfish/layouts/partials/header/basic.html @@ -7,8 +7,14 @@ <a href="{{ "" | relLangURL }}" class="flex"> <span class="sr-only">{{ .Site.Title | markdownify }}</span> + {{ if eq $logo.MediaType.SubType "svg" }} + <span class="logo object-scale-down object-left nozoom"> + {{ $logo.Content | safeHTML }} + </span> + {{ else }} <img src="{{ $logo.RelPermalink }}" width="{{ div $logo.Width 2 }}" height="{{ div $logo.Height 2 }}" class="logo max-h-[5rem] max-w-[5rem] object-scale-down object-left nozoom" alt="{{ .Site.Title }}" /> + {{ end }} </a> </div> diff --git a/themes/blowfish/layouts/partials/hero/background.html b/themes/blowfish/layouts/partials/hero/background.html index 1f6e3fb..6679950 100644 --- a/themes/blowfish/layouts/partials/hero/background.html +++ b/themes/blowfish/layouts/partials/hero/background.html @@ -41,7 +41,7 @@ style="background-image:url({{ .RelPermalink }});"> {{ end }} {{ else }} - {{ with .Resize "1200x" }} + {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }} <div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom" style="background-image:url({{ .RelPermalink }});"> {{ end }} diff --git a/themes/blowfish/layouts/partials/hero/basic.html b/themes/blowfish/layouts/partials/hero/basic.html index 4d01bb2..f192800 100644 --- a/themes/blowfish/layouts/partials/hero/basic.html +++ b/themes/blowfish/layouts/partials/hero/basic.html @@ -26,7 +26,7 @@ <div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div> {{ end }} {{ else }} - {{ with .Resize "1200x" }} + {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }} <div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div> {{ end }} {{ end }} diff --git a/themes/blowfish/layouts/partials/hero/big.html b/themes/blowfish/layouts/partials/hero/big.html index 4b61b83..60e5977 100644 --- a/themes/blowfish/layouts/partials/hero/big.html +++ b/themes/blowfish/layouts/partials/hero/big.html @@ -48,7 +48,7 @@ </figure> {{ end }} {{ else }} - {{ with .Resize "1200x" }} + {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }} <figure> <img class="w-full rounded-lg single_hero_round nozoom" alt="{{ $alt }}" width="{{ .Width }}" height="{{ .Height }}" src="{{ .RelPermalink }}"> {{ if $caption }} diff --git a/themes/blowfish/layouts/partials/hero/thumbAndBackground.html b/themes/blowfish/layouts/partials/hero/thumbAndBackground.html index 4b807ac..5f974c4 100644 --- a/themes/blowfish/layouts/partials/hero/thumbAndBackground.html +++ b/themes/blowfish/layouts/partials/hero/thumbAndBackground.html @@ -25,7 +25,7 @@ <div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div> {{ end }} {{ else }} -{{ with .Resize "1200x" }} +{{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }} <div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div> {{ end }} {{ end }} @@ -44,7 +44,7 @@ </div> </div>{{ end }} {{ else }} -{{ with .Resize "1200x" }} +{{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }} <div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom" style="background-image:url({{ .RelPermalink }});"> <div class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"> diff --git a/themes/blowfish/layouts/partials/home/background.html b/themes/blowfish/layouts/partials/home/background.html index 2746eea..3ba55dc 100644 --- a/themes/blowfish/layouts/partials/home/background.html +++ b/themes/blowfish/layouts/partials/home/background.html @@ -31,7 +31,7 @@ {{ end }} </div> <div class="relative px-1 py-1 flex flex-col items-center justify-center text-center"> - {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := "" }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $authorImage = resources.GetRemote . }} @@ -40,22 +40,22 @@ {{ end }} {{ if $authorImage }} {{ if not $disableImageOptimization }} - {{ $authorImage = $authorImage.Fill "288x288" }} + {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }} {{ end }} <img class="mb-2 rounded-full h-36 w-36" width="144" height="144" - alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> + alt="{{ $.Site.Params.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> {{ end }} {{ end }} <h1 class="mb-2 text-4xl font-extrabold text-neutral-800 dark:text-neutral-200"> - {{ .Site.Author.name | default .Site.Title }} + {{ .Site.Params.Author.name | default .Site.Title }} </h1> - {{ with .Site.Author.headline }} + {{ with .Site.Params.Author.headline }} <h2 class="mt-0 mb-0 text-xl text-neutral-800 dark:text-neutral-300"> {{ . | markdownify }} </h2> {{ end }} <div class="mt-3 mb-10 text-2xl"> - {{ with .Site.Author.links }} + {{ with .Site.Params.Author.links }} <div class="flex flex-wrap"> {{ range $links := . }} {{ range $name, $url := $links }} diff --git a/themes/blowfish/layouts/partials/home/hero.html b/themes/blowfish/layouts/partials/home/hero.html index 7a0a511..6f5be3a 100644 --- a/themes/blowfish/layouts/partials/home/hero.html +++ b/themes/blowfish/layouts/partials/home/hero.html @@ -28,7 +28,7 @@ {{ end }} </div> <div class="relative px-4 py-16 sm:px-6 sm:py-24 lg:py-32 lg:px-8 flex flex-col items-center justify-center text-center"> - {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := "" }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $authorImage = resources.GetRemote . }} @@ -37,22 +37,22 @@ {{ end }} {{ if $authorImage }} {{ if not $disableImageOptimization }} - {{ $authorImage = $authorImage.Fill "288x288" }} + {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }} {{ end }} <img class="mb-2 rounded-full h-36 w-36" width="144" height="144" - alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> + alt="{{ $.Site.Params.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> {{ end }} {{ end }} <h1 class="mb-2 text-4xl font-extrabold text-neutral-200"> - {{ .Site.Author.name | default .Site.Title }} + {{ .Site.Params.Author.name | default .Site.Title }} </h1> - {{ with .Site.Author.headline }} + {{ with .Site.Params.Author.headline }} <h2 class="mt-0 mb-0 text-xl text-neutral-300"> {{ . | markdownify }} </h2> {{ end }} <div class="mt-3 mb-10 text-2xl"> - {{ with .Site.Author.links }} + {{ with .Site.Params.Author.links }} <div class="flex flex-wrap"> {{ range $links := . }} {{ range $name, $url := $links }} diff --git a/themes/blowfish/layouts/partials/home/profile.html b/themes/blowfish/layouts/partials/home/profile.html index 09e8ada..e415db1 100644 --- a/themes/blowfish/layouts/partials/home/profile.html +++ b/themes/blowfish/layouts/partials/home/profile.html @@ -3,7 +3,7 @@ h-full {{ end }} flex flex-col items-center justify-center text-center"> <header class="relative px-1 py-1 flex flex-col items-center mb-3"> - {{ with .Site.Author.image }} + {{ with .Site.Params.Author.image }} {{ $authorImage := "" }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $authorImage = resources.GetRemote . }} @@ -12,16 +12,16 @@ {{ end }} {{ if $authorImage }} {{ if not $disableImageOptimization }} - {{ $authorImage = $authorImage.Fill "288x288" }} + {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }} {{ end }} - <img class="mb-2 rounded-full h-36 w-36" width="144" height="144" alt="{{ $.Site.Author.name | default " Author" }}" + <img class="mb-2 rounded-full h-36 w-36" width="144" height="144" alt="{{ $.Site.Params.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> {{ end }} {{ end }} <h1 class="text-4xl font-extrabold"> - {{ .Site.Author.name | default .Site.Title }} + {{ .Site.Params.Author.name | default .Site.Title }} </h1> - {{ with .Site.Author.headline }} + {{ with .Site.Params.Author.headline }} <h2 class="text-xl text-neutral-500 dark:text-neutral-400"> {{ . | markdownify }} </h2> diff --git a/themes/blowfish/layouts/partials/meta/date-updated.html b/themes/blowfish/layouts/partials/meta/date-updated.html index e0fca35..949a172 100644 --- a/themes/blowfish/layouts/partials/meta/date-updated.html +++ b/themes/blowfish/layouts/partials/meta/date-updated.html @@ -1,4 +1,4 @@ -<time datetime="{{ . }}"> - {{- i18n "article.date_updated" (dict "Date" (partial "functions/date.html" .)) | markdownify -}} +<time datetime="{{ . | time.Format "2006-01-02T15:04:05-07:00" }}"> + {{- i18n "article.date_updated" (dict "Date" (partial "functions/date.html" .)) -}} </time> {{- /* Trim EOF */ -}} diff --git a/themes/blowfish/layouts/partials/meta/date.html b/themes/blowfish/layouts/partials/meta/date.html index 10a639e..1454d0b 100644 --- a/themes/blowfish/layouts/partials/meta/date.html +++ b/themes/blowfish/layouts/partials/meta/date.html @@ -1,4 +1,4 @@ -<time datetime="{{ . }}"> - {{- i18n "article.date" (dict "Date" (partial "functions/date.html" .)) | markdownify -}} +<time datetime="{{ . | time.Format "2006-01-02T15:04:05-07:00" }}"> + {{- i18n "article.date" (dict "Date" (partial "functions/date.html" .)) -}} </time> {{- /* Trim EOF */ -}} diff --git a/themes/blowfish/layouts/partials/recent-articles/main.html b/themes/blowfish/layouts/partials/recent-articles/main.html index 856cb3f..65d722b 100644 --- a/themes/blowfish/layouts/partials/recent-articles/main.html +++ b/themes/blowfish/layouts/partials/recent-articles/main.html @@ -1,5 +1,5 @@ {{ $recentArticles := 5 }} -{{ $showMoreLinkDest := "/posts" }} +{{ $showMoreLinkDest := "/posts/" }} {{ if .Site.Params.homepage.showRecent | default false }} {{ if index .Site.Params.homepage "showRecentItems" }} {{ $recentArticles = .Site.Params.homepage.showRecentItems }} diff --git a/themes/blowfish/layouts/partials/schema.html b/themes/blowfish/layouts/partials/schema.html index 77ecfa3..04e4e7a 100644 --- a/themes/blowfish/layouts/partials/schema.html +++ b/themes/blowfish/layouts/partials/schema.html @@ -11,7 +11,7 @@ {{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }} "publisher" : { "@type": "Person", - "name": "{{ .Site.Author.name | safeJS }}" + "name": "{{ .Site.Params.Author.name | safeJS }}" } } </script> @@ -30,7 +30,7 @@ "url" : "{{ .Permalink }}", "author" : { "@type": "Person", - "name": "{{ .Site.Author.name | safeJS }}" + "name": "{{ .Site.Params.Author.name | safeJS }}" }, {{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }} {{ with .Date }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }} diff --git a/themes/blowfish/layouts/partials/vendor.html b/themes/blowfish/layouts/partials/vendor.html index d1e77f8..b273cf3 100644 --- a/themes/blowfish/layouts/partials/vendor.html +++ b/themes/blowfish/layouts/partials/vendor.html @@ -1,5 +1,5 @@ {{/* jQuery */}} -{{ $jqueryLib := resources.Get "lib/jquery/jquery.slim.min.js" }} +{{ $jqueryLib := resources.Get "lib/jquery/jquery.slim.min.js" | resources.Fingerprint "sha512" }} <script src="{{ $jqueryLib.RelPermalink }}" integrity="{{ $jqueryLib.Data.Integrity }}"></script> {{/* Mermaid */}} @@ -46,7 +46,7 @@ {{/* TypeIt */}} {{ if .Page.HasShortcode "typeit" }} -{{ $typeitLib := resources.Get "lib/typeit/typeit.umd.js" }} +{{ $typeitLib := resources.Get "lib/typeit/typeit.umd.js" | resources.Fingerprint "sha512" }} <script defer src="{{ $typeitLib.RelPermalink }}" integrity="{{ $typeitLib.Data.Integrity }}"></script> {{ end }} @@ -68,8 +68,8 @@ {{/* youtubeLite */}} {{ if .Page.HasShortcode "youtubeLite" }} -{{ $youtubeLiteJS := resources.Get "lib/lite-youtube-embed/lite-yt-embed.js" }} +{{ $youtubeLiteJS := resources.Get "lib/lite-youtube-embed/lite-yt-embed.js" | resources.Fingerprint "sha512" }} {{ $youtubeLiteCSS := resources.Get "lib/lite-youtube-embed/lite-yt-embed.css" }} <link rel="stylesheet" href="{{ $youtubeLiteCSS.RelPermalink }}" integrity="{{ $youtubeLiteCSS.Data.Integrity }}"/> <script src="{{ $youtubeLiteJS.RelPermalink }}" integrity="{{ $youtubeLiteJS.Data.Integrity }}"></script> -{{ end }}
\ No newline at end of file +{{ end }} |