diff options
Diffstat (limited to 'themes/blowfish/layouts')
32 files changed, 244 insertions, 69 deletions
diff --git a/themes/blowfish/layouts/_default/list.html b/themes/blowfish/layouts/_default/list.html index 9720468..7cc9238 100644 --- a/themes/blowfish/layouts/_default/list.html +++ b/themes/blowfish/layouts/_default/list.html @@ -30,10 +30,10 @@ var oid = "views_{{ $path }}" var oid_likes = "likes_{{ $path }}" </script> - {{ end }} {{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script> + {{ end }} </header> <section class="{{ if $toc -}} mt-12 diff --git a/themes/blowfish/layouts/_default/rss.xml b/themes/blowfish/layouts/_default/rss.xml index 741dcd7..eab2409 100644 --- a/themes/blowfish/layouts/_default/rss.xml +++ b/themes/blowfish/layouts/_default/rss.xml @@ -17,11 +17,11 @@ <link>{{ .Permalink }}</link> <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> <generator>Hugo -- gohugo.io</generator> - <language>{{ site.LanguageCode }}</language>{{ with .Site.Author.email }} - <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} - <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}} + <language>{{ site.LanguageCode }}</language>{{ with .Site.Params.Author.email }} + <managingEditor>{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Params.Author.email }} + <webMaster>{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}</webMaster>{{end}} {{ if .Site.Params.footer.showCopyright | default true -}} - <copyright>{{ with replace .Site.Params.copyright "{ year }" now.Year }}{{.}}{{ else }}© {{ now.Format "2006" }} {{ .Site.Author.name }}{{- end }}</copyright> + <copyright>{{ with replace .Site.Params.copyright "{ year }" now.Year }}{{.}}{{ else }}© {{ now.Format "2006" }} {{ .Site.Params.Author.name }}{{- end }}</copyright> {{- end }} {{ if not .Date.IsZero }}<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} {{- with .OutputFormats.Get "RSS" -}} @@ -32,7 +32,7 @@ <title>{{ .Title }}</title> <link>{{ .Permalink }}</link> <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> - {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} + {{ with .Site.Params.Author.email }}<author>{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}</author>{{end}} <guid>{{ .Permalink }}</guid> <description>{{ .Summary | html }}</description> {{ range ( where .Site.RegularPages ".RelPermalink" .RelPermalink | first 1 ) }} diff --git a/themes/blowfish/layouts/_default/single.html b/themes/blowfish/layouts/_default/single.html index ad07f7d..c0de7c4 100644 --- a/themes/blowfish/layouts/_default/single.html +++ b/themes/blowfish/layouts/_default/single.html @@ -46,7 +46,7 @@ {{- if $authorData -}} {{ range $taxonomyname, $taxonomy := $taxonomies }} {{ if (eq $taxonomyname $author) }} - {{ $taxonomyLink = delimit (slice $baseURL "/authors/" $author) "" }} + {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }} {{ end }} {{ end }} {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $taxonomyLink) }} @@ -81,6 +81,17 @@ <div class="article-content max-w-prose mb-20"> {{ .Content }} + {{ $defaultReplyByEmail := .Site.Params.replyByEmail }} + {{ $replyByEmail := default $defaultReplyByEmail .Params.replyByEmail }} + {{ if $replyByEmail }} + <strong class="block mt-8"> + <a target="_blank" + class="m-1 rounded bg-neutral-300 p-1.5 text-neutral-700 hover:bg-primary-500 hover:text-neutral dark:bg-neutral-700 dark:text-neutral-300 dark:hover:bg-primary-400 dark:hover:text-neutral-800" + href="mailto:{{ .Site.Params.Author.email }}?subject={{ replace (printf "Reply to %s" .Title) "\"" "'" }}"> + Reply by Email + </a> + </strong> + {{ end }} </div> {{ if (.Params.showAuthorBottom | default ( .Site.Params.article.showAuthorBottom | default false)) }} @@ -95,7 +106,7 @@ {{- if $authorData -}} {{ range $taxonomyname, $taxonomy := $taxonomies }} {{ if (eq $taxonomyname $author) }} - {{ $taxonomyLink = delimit (slice $baseURL "/authors/" $author) "" }} + {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }} {{ end }} {{ end }} {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $taxonomyLink) }} @@ -124,10 +135,10 @@ var oid = "views_{{ $path }}" var oid_likes = "likes_{{ $path }}" </script> - {{ end }} {{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script> + {{ end }} </section> <footer class="pt-8 max-w-prose print:hidden"> diff --git a/themes/blowfish/layouts/_default/taxonomy.html b/themes/blowfish/layouts/_default/taxonomy.html index b7a38c8..94859a6 100644 --- a/themes/blowfish/layouts/_default/taxonomy.html +++ b/themes/blowfish/layouts/_default/taxonomy.html @@ -28,7 +28,6 @@ {{ .Content }} </div> </section> - {{ end }} <script> var oid = "views_taxonomy_{{ .Data.Plural }}" var oid_likes = "likes_taxonomy_{{ .Data.Plural }}" @@ -36,7 +35,7 @@ {{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script> - + {{ end }} {{ if .Site.Params.taxonomy.cardView }} diff --git a/themes/blowfish/layouts/_default/term.html b/themes/blowfish/layouts/_default/term.html index db33bd7..ae8c702 100644 --- a/themes/blowfish/layouts/_default/term.html +++ b/themes/blowfish/layouts/_default/term.html @@ -1,6 +1,6 @@ {{ define "main" }} -{{ .Scratch.Set "scope" "list" }} +{{ .Scratch.Set "scope" "term" }} {{ if .Site.Params.term.showHero | default false }} {{ $heroStyle := print "partials/hero/" .Site.Params.term.heroStyle ".html" }} {{ if templates.Exists $heroStyle }} @@ -26,7 +26,6 @@ <div class="min-w-0 min-h-0 max-w-prose"> {{ .Content }} </div> - {{ end }} <script> var oid = "views_term_{{ .Data.Term }}" var oid_likes = "likes_term_{{ .Data.Term }}" @@ -34,14 +33,15 @@ {{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} <script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script> + {{ end }} </section> {{ if gt .Pages 0 }} - {{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }} - {{ $cardViewScreenWidth := .Site.Params.list.cardViewScreenWidth | default false }} - {{ $groupByYear := .Params.groupByYear | default ($.Site.Params.list.groupByYear | default false) }} + {{ $cardView := .Params.cardView | default (.Site.Params.term.cardView | default false) }} + {{ $cardViewScreenWidth := .Site.Params.term.cardViewScreenWidth | default false }} + {{ $groupByYear := .Params.groupByYear | default ($.Site.Params.term.groupByYear | default false) }} {{ if not $cardView }} @@ -121,7 +121,7 @@ {{ else }} <section class="mt-10 prose dark:prose-invert"> <p class="py-8 border-t"> - <em>{{ i18n "list.no_articles" | emojify }}</em> + <em>{{ i18n "term.no_articles" | emojify }}</em> </p> </section> {{ end }} 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 }} diff --git a/themes/blowfish/layouts/shortcodes/button.html b/themes/blowfish/layouts/shortcodes/button.html index c6a4c36..8bddea1 100644 --- a/themes/blowfish/layouts/shortcodes/button.html +++ b/themes/blowfish/layouts/shortcodes/button.html @@ -2,6 +2,7 @@ class="!rounded-md bg-primary-600 px-4 py-2 !text-neutral !no-underline hover:!bg-primary-500 dark:bg-primary-800 dark:hover:!bg-primary-700" {{ with .Get "href" }}href="{{ . }}"{{ end }} {{ with .Get "target" }}target="{{ . }}"{{ end }} + {{ with .Get "rel" }}rel="{{ . }}"{{ end }} role="button" > {{ .Inner }} diff --git a/themes/blowfish/layouts/shortcodes/codeberg.html b/themes/blowfish/layouts/shortcodes/codeberg.html index bd52323..a6a8efa 100644 --- a/themes/blowfish/layouts/shortcodes/codeberg.html +++ b/themes/blowfish/layouts/shortcodes/codeberg.html @@ -1,6 +1,6 @@ {{ $id := delimit (slice "codeberg" (partial "functions/uid.html" .)) "-" }} {{- $codebergURL := print "https://codeberg.org/api/v1/repos/" (.Get "repo") -}} -{{- $codebergData := getJSON ($codebergURL) -}} +{{- $codebergData := resources.GetRemote $codebergURL | transform.Unmarshal -}} {{- $codebergColors := .Site.Data.codebergColors -}} {{- with $codebergData -}} @@ -34,14 +34,14 @@ <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> {{ partial "icon.html" "star" }} </span> - <div id="{{ $id }}-stargazers" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + <div id="{{ $id }}-stars_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> {{ .stars_count }} </div> <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> {{ partial "icon.html" "fork" }} </span> - <div id="{{ $id }}-forks" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + <div id="{{ $id }}-forks_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> {{ .forks_count }} </div> @@ -58,7 +58,7 @@ .then(data => { document.getElementById('{{ $id }}-full_name').innerHTML = data.full_name; document.getElementById('{{ $id }}-description').innerHTML = data.description; - document.getElementById('{{ $id }}-stars_count').innerHTML = data.starts_count; + document.getElementById('{{ $id }}-stars_count').innerHTML = data.stars_count; document.getElementById('{{ $id }}-forks_count').innerHTML = data.forks_count; }) .catch(error => console.error(error)) diff --git a/themes/blowfish/layouts/shortcodes/forgejo.html b/themes/blowfish/layouts/shortcodes/forgejo.html new file mode 100644 index 0000000..689dbf8 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/forgejo.html @@ -0,0 +1,67 @@ +{{ $id := delimit (slice "forgejo" (partial "functions/uid.html" .)) "-" }} +{{- $forgejoURL := print (.Get "server" | default .Site.Params.forgejoDefaultServer) "/api/v1/repos/" (.Get "repo") -}} +{{- $forgejoData := resources.GetRemote $forgejoURL | transform.Unmarshal -}} +{{- $forgejoColors := .Site.Data.forgejoColors -}} +{{- with $forgejoData -}} + +<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer"> + <div + class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"> + + <div class="flex items-center"> + <span class="text-2xl text-neutral-800 dark:text-neutral" style="margin-right:10px;"> + {{ partial "icon.html" "forgejo" }} + </span> + <div + id="{{ $id }}-full_name" + class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ .full_name | markdownify }} + </div> + </div> + + <p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral"> + {{ .description | markdownify }} + </p> + + <div class="m-0 mt-2 flex items-center"> + + <span class="mr-1 inline-block h-3 w-3 rounded-full" + style="background-color: {{ if .language }} {{- index $forgejoColors .language -}} {{ else }} #0077b6 {{ end }}"></span> + <div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ if .language }} {{ .language }} {{ else }} null {{ end }} + </div> + + <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> + {{ partial "icon.html" "star" }} + </span> + <div id="{{ $id }}-stars_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ .stars_count }} + </div> + + <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> + {{ partial "icon.html" "fork" }} + </span> + <div id="{{ $id }}-forks_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ .forks_count }} + </div> + + </div> + + </div> + <script> + fetch({{ $forgejoURL }}, { + headers: new Headers({ + 'User-agent': 'Mozilla/4.0 Custom User Agent' + }) + }) + .then(response => response.json()) + .then(data => { + document.getElementById('{{ $id }}-full_name').innerHTML = data.full_name; + document.getElementById('{{ $id }}-description').innerHTML = data.description; + document.getElementById('{{ $id }}-stars_count').innerHTML = data.stars_count; + document.getElementById('{{ $id }}-forks_count').innerHTML = data.forks_count; + }) + .catch(error => console.error(error)) + </script> +</a> +{{- end -}} diff --git a/themes/blowfish/layouts/shortcodes/gitea.html b/themes/blowfish/layouts/shortcodes/gitea.html new file mode 100644 index 0000000..f4e15d7 --- /dev/null +++ b/themes/blowfish/layouts/shortcodes/gitea.html @@ -0,0 +1,67 @@ +{{ $id := delimit (slice "gitea" (partial "functions/uid.html" .)) "-" }} +{{- $giteaURL := print (.Get "server" | default .Site.Params.giteaDefaultServer) "/api/v1/repos/" (.Get "repo") -}} +{{- $giteaData := resources.GetRemote $giteaURL | transform.Unmarshal -}} +{{- $giteaColors := .Site.Data.giteaColors -}} +{{- with $giteaData -}} + +<a id="{{ $id }}" target="_blank" href="{{ .html_url }}" class="cursor-pointer"> + <div + class="w-full md:w-auto pt-3 p-5 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"> + + <div class="flex items-center"> + <span class="text-2xl text-neutral-800 dark:text-neutral" style="margin-right:10px;"> + {{ partial "icon.html" "gitea" }} + </span> + <div + id="{{ $id }}-full_name" + class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ .full_name | markdownify }} + </div> + </div> + + <p id="{{ $id }}-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-neutral"> + {{ .description | markdownify }} + </p> + + <div class="m-0 mt-2 flex items-center"> + + <span class="mr-1 inline-block h-3 w-3 rounded-full" + style="background-color: {{ if .language }} {{- index $giteaColors .language -}} {{ else }} #0077b6 {{ end }}"></span> + <div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ if .language }} {{ .language }} {{ else }} null {{ end }} + </div> + + <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> + {{ partial "icon.html" "star" }} + </span> + <div id="{{ $id }}-stars_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ .stars_count }} + </div> + + <span class="text-md mr-1 text-neutral-800 dark:text-neutral"> + {{ partial "icon.html" "fork" }} + </span> + <div id="{{ $id }}-forks_count" class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral"> + {{ .forks_count }} + </div> + + </div> + + </div> + <script> + fetch({{ $giteaURL }}, { + headers: new Headers({ + 'User-agent': 'Mozilla/4.0 Custom User Agent' + }) + }) + .then(response => response.json()) + .then(data => { + document.getElementById('{{ $id }}-full_name').innerHTML = data.full_name; + document.getElementById('{{ $id }}-description').innerHTML = data.description; + document.getElementById('{{ $id }}-stars_count').innerHTML = data.stars_count; + document.getElementById('{{ $id }}-forks_count').innerHTML = data.forks_count; + }) + .catch(error => console.error(error)) + </script> +</a> +{{- end -}} diff --git a/themes/blowfish/layouts/shortcodes/github.html b/themes/blowfish/layouts/shortcodes/github.html index 2daecd6..5614697 100644 --- a/themes/blowfish/layouts/shortcodes/github.html +++ b/themes/blowfish/layouts/shortcodes/github.html @@ -1,6 +1,6 @@ {{ $id := delimit (slice "github" (partial "functions/uid.html" .)) "-" }} {{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}} -{{- $githubData := getJSON ($githubURL) -}} +{{- $githubData := resources.GetRemote $githubURL | transform.Unmarshal -}} {{- $githubColors := .Site.Data.githubColors -}} {{- with $githubData -}} diff --git a/themes/blowfish/layouts/shortcodes/gitlab.html b/themes/blowfish/layouts/shortcodes/gitlab.html index 5b6153c..12f0880 100644 --- a/themes/blowfish/layouts/shortcodes/gitlab.html +++ b/themes/blowfish/layouts/shortcodes/gitlab.html @@ -1,7 +1,7 @@ {{ $id := delimit (slice "gitlab" (partial "functions/uid.html" .)) "-" }} {{- $gitlabURL := print (default "https://gitlab.com/" (.Get "baseURL")) "api/v4/projects/" (.Get "projectID") -}} -{{- $gitLabData := getJSON ($gitlabURL) -}} +{{- $gitLabData := resources.GetRemote $gitlabURL | transform.Unmarshal -}} {{- with $gitLabData -}} <a id="{{ $id }}" target="_blank" href="{{ .web_url }}" class="cursor-pointer"> |