diff options
Diffstat (limited to 'themes/blowfish/layouts/partials')
69 files changed, 2346 insertions, 0 deletions
diff --git a/themes/blowfish/layouts/partials/analytics/fathom.html b/themes/blowfish/layouts/partials/analytics/fathom.html new file mode 100644 index 0000000..3b7ac10 --- /dev/null +++ b/themes/blowfish/layouts/partials/analytics/fathom.html @@ -0,0 +1,5 @@ +{{ if isset site.Params.fathomAnalytics "domain" }} +<script defer src="https://{{ site.Params.fathomAnalytics.domain }}/script.js" data-site="{{ site.Params.fathomAnalytics.site }}"></script> +{{ else }} +<script defer src="https://cdn.usefathom.com/script.js" data-site="{{ site.Params.fathomAnalytics.site }}"></script> +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/analytics/ga.html b/themes/blowfish/layouts/partials/analytics/ga.html new file mode 100644 index 0000000..3523d5a --- /dev/null +++ b/themes/blowfish/layouts/partials/analytics/ga.html @@ -0,0 +1,8 @@ +<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.Config.Services.GoogleAnalytics.ID }}"></script> +<script> + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + + gtag('config', '{{ site.Config.Services.GoogleAnalytics.ID }}'); +</script>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/analytics/main.html b/themes/blowfish/layouts/partials/analytics/main.html new file mode 100644 index 0000000..5db13e5 --- /dev/null +++ b/themes/blowfish/layouts/partials/analytics/main.html @@ -0,0 +1,9 @@ +{{ with site.Params.fathomAnalytics.site }} +{{ partial "analytics/fathom.html" }} +{{ end }} +{{ with site.Config.Services.GoogleAnalytics.ID }} +{{ partial "analytics/ga.html" }} +{{ end }} +{{ with site.Params.umamiAnalytics.websiteid }} +{{ partial "analytics/umami.html" }} +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/analytics/umami.html b/themes/blowfish/layouts/partials/analytics/umami.html new file mode 100644 index 0000000..67bf4b7 --- /dev/null +++ b/themes/blowfish/layouts/partials/analytics/umami.html @@ -0,0 +1,16 @@ +{{ if isset site.Params.umamiAnalytics "domain" }} +<script data-id="umami-script" async src="https://{{ site.Params.umamiAnalytics.domain }}/script.js" data-website-id="{{ site.Params.umamiAnalytics.websiteid }}"> +</script> +{{ else }} +<script data-id="umami-script" async src="https://analytics.umami.is/script.js" data-website-id="{{ site.Params.umamiAnalytics.websiteid }}"> +</script> +{{ end }} + +<script type="text/javascript"> + document.querySelector('script[data-id="umami-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'); + umami.track(type + ':' + title, {'url': url}); + }); +</script>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-link/card-related.html b/themes/blowfish/layouts/partials/article-link/card-related.html new file mode 100644 index 0000000..c7dbcc3 --- /dev/null +++ b/themes/blowfish/layouts/partials/article-link/card-related.html @@ -0,0 +1,76 @@ +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} +{{ with .Params.externalUrl }} +<a href="{{ . }}" target="_blank" rel="external" class="min-w-full"> + {{ else }} + <a href="{{ .RelPermalink }}" class="min-w-full"> + {{ end }} + <div class="min-h-full border border-neutral-200 dark:border-neutral-700 border-2 rounded overflow-hidden shadow-2xl relative"> + + {{- with $.Params.images -}} + {{- range first 6 . }} + <meta property="og:image" content="{{ . | absURL }}" />{{ end -}} + {{- else -}} + {{- $images := $.Resources.ByType "image" -}} + {{- $featured := $images.GetMatch "*feature*" -}} + {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} + {{ if and .Params.featureimage (not $featured) }} + {{- $url:= .Params.featureimage -}} + {{ $featured = resources.GetRemote $url }} + {{ end }} + {{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} + {{- with $featured -}} + {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}} + {{ with . }} + <div class="w-full thumbnail_card_related nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ else }} + {{ with .Resize "600x" }} + <div class="w-full thumbnail_card_related nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ end }} + {{- else -}} + {{- with $.Site.Params.images }} + <meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}} + {{- end -}} + {{- end -}} + + + {{ if and .Draft .Site.Params.article.showDraftLabel }} + <span class="absolute top-0 right-0 m-2"> + {{ partial "badge.html" (i18n "article.draft" | emojify) }} + </span> + {{ end }} + + <div class="px-6 py-4"> + + {{ with .Params.externalUrl }} + <div> + <div + class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ $.Title | emojify }} + <span class="text-xs align-top cursor-default text-neutral-400 dark:text-neutral-500"> + <span class="rtl:hidden">↗</span> + <span class="ltr:hidden">↖</span> + </span> + </div> + </div> + {{ else }} + <div class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral" + href="{{ .RelPermalink }}">{{ .Title | emojify }}</div> + {{ end }} + + <div class="text-sm text-neutral-500 dark:text-neutral-400"> + {{ partial "article-meta/basic.html" . }} + </div> + + {{ if .Params.showSummary | default (.Site.Params.list.showSummary | default false) }} + <div class="py-1 prose dark:prose-invert"> + {{ .Summary | emojify }} + </div> + {{ end }} + </div> + <div class="px-6 pt-4 pb-2"> + + </div> + </div> + </a>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-link/card.html b/themes/blowfish/layouts/partials/article-link/card.html new file mode 100644 index 0000000..dd2a788 --- /dev/null +++ b/themes/blowfish/layouts/partials/article-link/card.html @@ -0,0 +1,77 @@ +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} +{{ with .Params.externalUrl }} +<a href="{{ . }}" target="_blank" rel="external" class="min-w-full"> + {{ else }} + <a href="{{ .RelPermalink }}" class="min-w-full"> + {{ end }} + <div class="min-h-full border border-neutral-200 dark:border-neutral-700 border-2 rounded overflow-hidden shadow-2xl relative"> + + {{- with $.Params.images -}} + {{- range first 6 . }} + <meta property="og:image" content="{{ . | absURL }}" />{{ end -}} + {{- else -}} + {{- $images := $.Resources.ByType "image" -}} + {{- $featured := $images.GetMatch "*feature*" -}} + {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} + {{ if and .Params.featureimage (not $featured) }} + {{- $url:= .Params.featureimage -}} + {{ $featured = resources.GetRemote $url }} + {{ end }} + {{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} + {{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }} + {{- with $featured -}} + {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}} + {{ with . }} + <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ else }} + {{ with .Resize "600x" }} + <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ end }} + {{- else -}} + {{- with $.Site.Params.images }} + <meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}} + {{- end -}} + {{- end -}} + + + {{ if and .Draft .Site.Params.article.showDraftLabel }} + <span class="absolute top-0 right-0 m-2"> + {{ partial "badge.html" (i18n "article.draft" | emojify) }} + </span> + {{ end }} + + <div class="px-6 py-4"> + + {{ with .Params.externalUrl }} + <div> + <div + class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ $.Title | emojify }} + <span class="text-xs align-top cursor-default text-neutral-400 dark:text-neutral-500"> + <span class="rtl:hidden">↗</span> + <span class="ltr:hidden">↖</span> + </span> + </div> + </div> + {{ else }} + <div class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral" + href="{{ .RelPermalink }}">{{ .Title | emojify }}</div> + {{ end }} + + <div class="text-sm text-neutral-500 dark:text-neutral-400"> + {{ partial "article-meta/basic.html" . }} + </div> + + {{ if .Params.showSummary | default (.Site.Params.list.showSummary | default false) }} + <div class="py-1 prose dark:prose-invert"> + {{ .Summary | emojify }} + </div> + {{ end }} + </div> + <div class="px-6 pt-4 pb-2"> + + </div> + </div> + </a>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-link/simple.html b/themes/blowfish/layouts/partials/article-link/simple.html new file mode 100644 index 0000000..afee487 --- /dev/null +++ b/themes/blowfish/layouts/partials/article-link/simple.html @@ -0,0 +1,101 @@ +{{ $constrainItemsWidth := .Page.Site.Params.list.constrainItemsWidth | default false }} + +{{ $articleClasses := "flex flex-wrap article" }} +{{ if .Site.Params.list.showCards }} +{{ $articleClasses = delimit (slice $articleClasses "border border-neutral-200 dark:border-neutral-700 border-2 rounded-md overflow-hidden") " " }} +{{ else }} +{{ $articleClasses = delimit (slice $articleClasses "") " " }} +{{ end }} + +{{ $articleImageClasses := "w-full md:w-auto h-full thumbnail nozoom" }} +{{ if .Site.Params.list.showCards }} +{{ $articleImageClasses = delimit (slice $articleImageClasses "") " " }} +{{ else }} +{{ $articleImageClasses = delimit (slice $articleImageClasses "thumbnailshadow md:mr-7") " " }} +{{ end }} + +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} + +{{ $articleInnerClasses := "" }} +{{ if .Site.Params.list.showCards }} +{{ $articleInnerClasses = delimit (slice $articleInnerClasses "p-4") " " }} +{{ else }} +{{ $articleInnerClasses = delimit (slice $articleInnerClasses "mt-3 md:mt-0") " " }} +{{ end }} + +{{ if $constrainItemsWidth }} +{{ $articleClasses = delimit (slice $articleClasses "max-w-prose") " " }} +{{ end }} + + +{{ with .Params.externalUrl }} +<a class="{{ $articleClasses }}" href="{{ . }}" target="_blank" rel="external"> + {{ else }} + <a class="{{ $articleClasses }}" href="{{ .RelPermalink }}"> + {{ end }} + {{- with $.Params.images -}} + {{- range first 6 . }} + <meta property="og:image" content="{{ . | absURL }}" />{{ end -}} + {{- else -}} + {{- $images := $.Resources.ByType "image" -}} + {{- $featured := $images.GetMatch "*feature*" -}} + {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} + {{ if and .Params.featureimage (not $featured) }} + {{- $url:= .Params.featureimage -}} + {{ $featured = resources.GetRemote $url }} + {{ end }} + {{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} + {{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }} + {{- with $featured -}} + {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}} + {{ with . }} + <div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ else }} + {{ with .Resize "600x" }} + <div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ end }} + {{- else -}} + {{- with $.Site.Params.images }} + <meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}} + {{- end -}} + {{- end -}} + + + <div class="{{ $articleInnerClasses }}"> + <div class="items-center text-left text-xl font-semibold"> + {{ with .Params.externalUrl }} + <div> + <div + class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ $.Title | emojify }} + <span class="text-xs align-top cursor-default text-neutral-400 dark:text-neutral-500"> + <span class="rtl:hidden">↗</span> + <span class="ltr:hidden">↖</span> + </span> + </div> + </div> + {{ else }} + <div class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral" + href="{{ .RelPermalink }}">{{ .Title | emojify }}</div> + {{ end }} + {{ if and .Draft .Site.Params.article.showDraftLabel }} + <div class=" ltr:ml-2 rtl:mr-2"> + {{ partial "badge.html" (i18n "article.draft" | emojify) }} + </div> + {{ end }} + {{ if templates.Exists "partials/extend-article-link.html" }} + {{ partial "extend-article-link.html" . }} + {{ end }} + </div> + <div class="text-sm text-neutral-500 dark:text-neutral-400"> + {{ partial "article-meta/basic.html" . }} + </div> + {{ if .Params.showSummary | default (.Site.Params.list.showSummary | default false) }} + <div class="py-1 max-w-fit prose dark:prose-invert"> + {{ .Summary | emojify }} + </div> + {{ end }} + </div> + </a>
\ 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 new file mode 100644 index 0000000..40d12d5 --- /dev/null +++ b/themes/blowfish/layouts/partials/article-meta/basic.html @@ -0,0 +1,99 @@ +{{/* Determine the correct context and scope */}} +{{/* This allows for different logic depending on where the partial is called */}} +{{ $context := . }} +{{ $scope := default nil }} + +{{ if (reflect.IsMap . ) }} + {{ $context = .context }} + {{ $scope = cond (not .scope) nil .scope }} +{{ end }} + +{{ with $context }} +{{ $meta := newScratch }} + +{{/* Gather partials for this context */}} +{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }} + {{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }} +{{else if and (eq $scope "single") (.Params.showDateOnlyInArticle | default (.Site.Params.article.showDateOnlyInArticle | default false)) }} + {{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }} +{{ end }} + +{{ if and (.Params.showDateUpdated | default (.Site.Params.article.showDateUpdated | default false)) (ne (partial +"functions/date.html" .Date) (partial "functions/date.html" .Lastmod)) }} + {{ $meta.Add "partials" (slice (partial "meta/date-updated.html" .Lastmod)) }} +{{ end }} + +{{ if and (.Params.showWordCount | default (.Site.Params.article.showWordCount | default false)) (ne .WordCount 0) }} + {{ $meta.Add "partials" (slice (partial "meta/word-count.html" .)) }} +{{ end }} + +{{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) +}} + {{ $meta.Add "partials" (slice (partial "meta/reading-time.html" .)) }} +{{ end }} + +{{ if and (not .Params.externalURL) (.Params.showViews | default (.Site.Params.article.showViews | default false)) }} + {{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }} +{{ end }} + +{{ if and (not .Params.externalURL) (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }} + {{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }} +{{ end }} + +{{ if and (eq $scope "single") (not .Params.externalURL) (.Params.showLikes | default (.Site.Params.article.showLikes | default false)) }} + {{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }} +{{ end }} + +{{ if and (eq $scope "single") (.Params.showEdit | default (.Site.Params.article.showEdit | default false)) }} + {{ $meta.Add "partials" (slice (partial "meta/edit.html" .)) }} +{{ end }} + +{{ if and (eq $scope "single") (.Params.showZenMode | default (.Site.Params.article.showZenMode | default false)) }} + {{ $meta.Add "partials" (slice (partial "meta/zen-mode.html" .)) }} +{{ end }} + + +<div class="flex flex-row flex-wrap items-center"> + {{/* Output partials */}} + {{ with ($meta.Get "partials") }} + {{ delimit . "<span class=\"px-2 text-primary-500\">·</span>" | safeHTML }} + {{ end }} + + {{/* Output draft label */}} + {{ if and (eq $scope "single") (and .Draft .Site.Params.article.showDraftLabel) }} + <span class="pl-2">{{ partial "badge.html" (i18n "article.draft" | emojify) }}</span> + {{ end }} +</div> + +{{ if .Params.showAuthorsBadges | default (.Site.Params.article.showAuthorsBadges | default false) }} +<div class="flex flex-row flex-wrap items-center"> + {{ range $taxonomy, $terms := .Site.Taxonomies }} + {{ if (eq $taxonomy "authors")}} + {{ if (gt (len ($context.GetTerms $taxonomy)) 0) }} + {{ range $i, $a := $context.GetTerms $taxonomy }} + {{ if not (eq $i 0) }} , {{ end }} <div style="cursor: pointer;" onclick="window.open({{ $a.RelPermalink }},'_self')">{{ $a.LinkTitle }}</div> + {{ end }} + {{ end }} + {{ end }} + {{ end }} +</div> +{{ end }} + +{{/* Output taxonomies */}} +{{ if .Params.showTaxonomies | default (.Site.Params.article.showTaxonomies | default false) }} +<div class="flex flex-row flex-wrap items-center"> + {{ range $taxonomy, $terms := .Site.Taxonomies }} + {{ if and (not (eq $taxonomy "authors")) (not (eq $taxonomy "series"))}} + {{ if (gt (len ($context.GetTerms $taxonomy)) 0) }} + {{ range $context.GetTerms $taxonomy }} + <span style="margin-top:0.5rem" class="mr-2" onclick="window.open({{ .RelPermalink }},'_self');"> + {{ partial "badge.html" .LinkTitle }} + </span> + {{ end }} + {{ end }} + {{ end }} + {{ end }} +</div> +{{ end }} + +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-meta/list.html b/themes/blowfish/layouts/partials/article-meta/list.html new file mode 100644 index 0000000..4bf21c5 --- /dev/null +++ b/themes/blowfish/layouts/partials/article-meta/list.html @@ -0,0 +1,36 @@ +{{/* Determine the correct context and scope */}} +{{/* This allows for different logic depending on where the partial is called */}} +{{ $context := . }} +{{ $scope := default nil }} + +{{ if (reflect.IsMap . ) }} +{{ $context = .context }} +{{ $scope = cond (not .scope) nil .scope }} +{{ end }} + +{{ with $context }} +{{ $meta := newScratch }} + +{{/* Gather partials for this context */}} + +{{ if (.Params.showViews | default (.Site.Params.list.showViews | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }} +{{ end }} + +{{ if (.Params.showLikes | default (.Site.Params.list.showLikes | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }} +{{ end }} + +{{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.list.showLikes | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }} +{{ end }} + + +<div class="flex flex-row flex-wrap items-center"> + {{/* Output partials */}} + {{ with ($meta.Get "partials") }} + {{ delimit . "<span class=\"px-2 text-primary-500\">·</span>" | safeHTML}} + {{ end }} +</div> + +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-meta/taxonomy.html b/themes/blowfish/layouts/partials/article-meta/taxonomy.html new file mode 100644 index 0000000..add05bf --- /dev/null +++ b/themes/blowfish/layouts/partials/article-meta/taxonomy.html @@ -0,0 +1,36 @@ +{{/* Determine the correct context and scope */}} +{{/* This allows for different logic depending on where the partial is called */}} +{{ $context := . }} +{{ $scope := default nil }} + +{{ if (reflect.IsMap . ) }} +{{ $context = .context }} +{{ $scope = cond (not .scope) nil .scope }} +{{ end }} + +{{ with $context }} +{{ $meta := newScratch }} + +{{/* Gather partials for this context */}} + +{{ if (.Params.showViews | default (.Site.Params.taxonomy.showViews | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }} +{{ end }} + +{{ if (.Params.showLikes | default (.Site.Params.taxonomy.showLikes | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }} +{{ end }} + +{{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.taxonomy.showLikes | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }} +{{ end }} + + +<div class="flex flex-row flex-wrap items-center"> + {{/* Output partials */}} + {{ with ($meta.Get "partials") }} + {{ delimit . "<span class=\"px-2 text-primary-500\">·</span>" | safeHTML}} + {{ end }} +</div> + +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-meta/term.html b/themes/blowfish/layouts/partials/article-meta/term.html new file mode 100644 index 0000000..d5377dc --- /dev/null +++ b/themes/blowfish/layouts/partials/article-meta/term.html @@ -0,0 +1,36 @@ +{{/* Determine the correct context and scope */}} +{{/* This allows for different logic depending on where the partial is called */}} +{{ $context := . }} +{{ $scope := default nil }} + +{{ if (reflect.IsMap . ) }} +{{ $context = .context }} +{{ $scope = cond (not .scope) nil .scope }} +{{ end }} + +{{ with $context }} +{{ $meta := newScratch }} + +{{/* Gather partials for this context */}} + +{{ if (.Params.showViews | default (.Site.Params.term.showViews | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/views.html" .)) }} +{{ end }} + +{{ if (.Params.showLikes | default (.Site.Params.term.showLikes | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/likes.html" .)) }} +{{ end }} + +{{ if and (eq $scope "single") (.Params.showLikes | default (.Site.Params.term.showLikes | default false)) }} +{{ $meta.Add "partials" (slice (partial "meta/likes_button.html" .)) }} +{{ end }} + + +<div class="flex flex-row flex-wrap items-center"> + {{/* Output partials */}} + {{ with ($meta.Get "partials") }} + {{ delimit . "<span class=\"px-2 text-primary-500\">·</span>" | safeHTML}} + {{ end }} +</div> + +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-pagination.html b/themes/blowfish/layouts/partials/article-pagination.html new file mode 100644 index 0000000..bb2fe79 --- /dev/null +++ b/themes/blowfish/layouts/partials/article-pagination.html @@ -0,0 +1,65 @@ +{{ if .Params.showPagination | default (.Site.Params.article.showPagination | default true) }} + {{ if or .NextInSection .PrevInSection }} + {{ $next := .NextInSection }} + {{ $prev := .PrevInSection }} + {{ if .Params.invertPagination | default (.Site.Params.article.invertPagination | default false) }} + {{ $next = .PrevInSection }} + {{ $prev = .NextInSection }} + {{ end }} + <div class="pt-8"> + <hr class="border-dotted border-neutral-300 dark:border-neutral-600" /> + <div class="flex justify-between pt-3"> + <span> + {{ if $prev }} + <a class="flex group mr-3" href="{{ $prev.RelPermalink }}"> + <span + class="mr-3 text-neutral-700 group-hover:text-primary-600 ltr:inline rtl:hidden dark:text-neutral dark:group-hover:text-primary-400" + >←</span + > + <span + class="ml-3 text-neutral-700 group-hover:text-primary-600 ltr:hidden rtl:inline dark:text-neutral dark:group-hover:text-primary-400" + >→</span + > + <span class="flex flex-col"> + <span + class="mt-[0.1rem] leading-6 group-hover:underline group-hover:decoration-primary-500" + >{{ $prev.Title | emojify }}</span + > + <span class="mt-[0.1rem] text-xs text-neutral-500 dark:text-neutral-400"> + {{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }} + {{ partial "meta/date.html" $prev.Date }} + {{ end }} + </span> + </span> + </a> + {{ end }} + </span> + <span> + {{ if $next }} + <a class="flex text-right group ml-3" href="{{ $next.RelPermalink }}"> + <span class="flex flex-col"> + <span + class="mt-[0.1rem] leading-6 group-hover:underline group-hover:decoration-primary-500" + >{{ $next.Title | emojify }}</span + > + <span class="mt-[0.1rem] text-xs text-neutral-500 dark:text-neutral-400"> + {{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }} + {{ partial "meta/date.html" $next.Date }} + {{ end }} + </span> + </span> + <span + class="ml-3 text-neutral-700 group-hover:text-primary-600 ltr:inline rtl:hidden dark:text-neutral dark:group-hover:text-primary-400" + >→</span + > + <span + class="mr-3 text-neutral-700 group-hover:text-primary-600 ltr:hidden rtl:inline dark:text-neutral dark:group-hover:text-primary-400" + >←</span + > + </a> + {{ end }} + </span> + </div> + </div> + {{ end }} +{{ end }} diff --git a/themes/blowfish/layouts/partials/author-extra.html b/themes/blowfish/layouts/partials/author-extra.html new file mode 100644 index 0000000..701e9fa --- /dev/null +++ b/themes/blowfish/layouts/partials/author-extra.html @@ -0,0 +1,44 @@ +{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} +<div class="flex author author-extra mt-4"> + {{ with .data.image }} + {{ $authorImage := resources.Get . }} + {{ if $authorImage }} + {{ 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" + 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" + src="{{ $authorImage.RelPermalink }}" /> + {{ end }} + {{ end }} + <div class="place-self-center"> + {{ $link := .link}} + {{ with .data.name | markdownify | emojify }} + <div class="text-[0.6rem] uppercase leading-3 text-neutral-500 dark:text-neutral-400"> + {{ i18n "author.byline_title" | markdownify | emojify }} + </div> + <a {{ if $link }} href="{{ $link }}" {{ end }} class="font-semibold leading-6 text-neutral-800 dark:text-neutral-300"> + {{ . }} + </a> + {{ end }} + {{ with .data.bio | markdownify | emojify }} + <div class="text-sm text-neutral-700 dark:text-neutral-400">{{ . }}</div> + {{ end }} + <div class="text-2xl sm:text-lg"> + <div class="flex flex-wrap text-neutral-400 dark:text-neutral-500"> + {{ range .data.social }} + {{ range $name, $link := . }} + <a class="px-1 hover:text-primary-700 dark:hover:text-primary-400" href="{{ $link }}" target="_blank" + aria-label="{{ $name | title }}" rel="me noopener noreferrer"><span class="inline-block align-text-bottom">{{ partial "icon.html" $name }}</span></a> + {{ end }} + {{ end }} + </div> + </div> + </div> +</div>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/author-links.html b/themes/blowfish/layouts/partials/author-links.html new file mode 100644 index 0000000..745c0d1 --- /dev/null +++ b/themes/blowfish/layouts/partials/author-links.html @@ -0,0 +1,16 @@ +{{ with .Site.Author.links }} + <div class="flex flex-wrap text-neutral-400 dark:text-neutral-500"> + {{ range $links := . }} + {{ range $name, $url := $links }} + <a + class="px-1 hover:text-primary-700 dark:hover:text-primary-400" + href="{{ $url | safeURL }}" + target="_blank" + aria-label="{{ $name | title }}" + rel="me noopener noreferrer" + ><span class="inline-block align-text-bottom">{{ partial "icon.html" $name }}</span></a + > + {{ end }} + {{ end }} + </div> +{{ end }} diff --git a/themes/blowfish/layouts/partials/author.html b/themes/blowfish/layouts/partials/author.html new file mode 100644 index 0000000..c544a2f --- /dev/null +++ b/themes/blowfish/layouts/partials/author.html @@ -0,0 +1,39 @@ +{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} +<div class="flex author"> + {{ with .Site.Author.image }} + {{ $authorImage := "" }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $authorImage = resources.GetRemote . }} + {{ else }} + {{ $authorImage = resources.Get . }} + {{ end }} + {{ if $authorImage }} + {{ 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 }}" /> + {{ 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 }}" /> + {{ end }} + {{ end }} + <div class="place-self-center"> + {{ with .Site.Author.name | markdownify | emojify }} + <div class="text-[0.6rem] uppercase leading-3 text-neutral-500 dark:text-neutral-400"> + {{ i18n "author.byline_title" | markdownify | emojify }} + </div> + <div class="font-semibold leading-6 text-neutral-800 dark:text-neutral-300"> + {{ . }} + </div> + {{ end }} + {{ with .Site.Author.bio | markdownify | emojify }} + <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> + </div> +</div> diff --git a/themes/blowfish/layouts/partials/badge.html b/themes/blowfish/layouts/partials/badge.html new file mode 100644 index 0000000..af7501b --- /dev/null +++ b/themes/blowfish/layouts/partials/badge.html @@ -0,0 +1,5 @@ +<span class="flex" style="cursor: pointer;"> + <span class="rounded-md border border-primary-400 px-1 py-[1px] text-xs font-normal text-primary-700 dark:border-primary-600 dark:text-primary-400"> + {{ . }} + </span> +</span>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/breadcrumbs.html b/themes/blowfish/layouts/partials/breadcrumbs.html new file mode 100644 index 0000000..848699b --- /dev/null +++ b/themes/blowfish/layouts/partials/breadcrumbs.html @@ -0,0 +1,21 @@ +<ol class="text-sm text-neutral-500 dark:text-neutral-400 print:hidden"> + {{ template "crumb" (dict "p1" . "p2" .) }} +</ol> +{{ define "crumb" }} + {{ if .p1.Parent }} + {{ template "crumb" (dict "p1" .p1.Parent "p2" .p2 ) }} + {{ else if not .p1.IsHome }} + {{ template "crumb" (dict "p1" .p1.Site.Home "p2" .p2 ) }} + {{ end }} + <li class="inline {{ if or (eq .p1 .p2) (.p1.IsHome) }}hidden{{ end }}"> + <a + class="hover:underline decoration-neutral-300 dark:underline-neutral-600" + href="{{ .p1.RelPermalink }}" + >{{ if .p1.Title }} + {{- .p1.Title -}} + {{ else }} + {{- .p1.Section -}} + {{ end }}</a + ><span class="px-1 text-primary-500">/</span> + </li> +{{ end }} diff --git a/themes/blowfish/layouts/partials/footer.html b/themes/blowfish/layouts/partials/footer.html new file mode 100644 index 0000000..1f8fc5f --- /dev/null +++ b/themes/blowfish/layouts/partials/footer.html @@ -0,0 +1,68 @@ +<footer id="site-footer" class="py-10 print:hidden"> + {{/* Footer menu */}} + {{ if .Site.Params.footer.showMenu | default true }} + {{ if .Site.Menus.footer }} + <nav class="flex flex-row pb-4 text-base font-medium text-neutral-500 dark:text-neutral-400"> + <ul class="flex flex-col list-none sm:flex-row"> + {{ range .Site.Menus.footer }} + <li class="flex mb-1 ltr:text-right rtl:text-left sm:mb-0 ltr:sm:mr-7 ltr:sm:last:mr-0 rtl:sm:ml-7 rtl:sm:last:ml-0"> + <a class="decoration-primary-500 hover:underline hover:decoration-2 hover:underline-offset-2 flex items-center" href="{{ .URL }}" + title="{{ .Title }}"> + {{ if .Pre }} + <span {{ if and .Pre .Name}} class="mr-1" {{ end }}> + {{ partial "icon.html" .Pre }} + </span> + {{ end }} + {{ .Name | markdownify | emojify }} + </a> + </li> + {{ end }} + </ul> + </nav> + {{ end }} + {{ end }} + <div class="flex items-center justify-between"> + + {{/* Copyright */}} + {{ if .Site.Params.footer.showCopyright | default true }} + <p class="text-sm text-neutral-500 dark:text-neutral-400"> + {{- with replace .Site.Params.copyright "{ year }" now.Year }} + {{ . | emojify | markdownify }} + {{- else }} + © + {{ now.Format "2006" }} + {{ .Site.Author.name | markdownify | emojify }} + {{- end }} + </p> + {{ end }} + + {{/* Theme attribution */}} + {{ if .Site.Params.footer.showThemeAttribution | default true }} + <p class="text-xs text-neutral-500 dark:text-neutral-400"> + {{ $hugo := printf `<a class="hover:underline hover:decoration-primary-400 hover:text-primary-500" + href="https://gohugo.io/" target="_blank" rel="noopener noreferrer">Hugo</a>` + }} + {{ $blowfish := printf `<a class="hover:underline hover:decoration-primary-400 hover:text-primary-500" + href="https://blowfish.page/" target="_blank" rel="noopener noreferrer">Blowfish</a>` }} + {{ i18n "footer.powered_by" (dict "Hugo" $hugo "Theme" $blowfish) | safeHTML }} + </p> + {{ end }} + + </div> + <script> + {{ if not .Site.Params.disableImageZoom | default true }} + mediumZoom(document.querySelectorAll("img:not(.nozoom)"), { + margin: 24, + background: 'rgba(0,0,0,0.5)', + scrollOffset: 0, + }) + {{ end }} + </script> + {{ $jsProcess := resources.Get "js/process.js" }} + {{ $jsProcess = $jsProcess | resources.Minify | resources.Fingerprint "sha512" }} + <script type="text/javascript" src="{{ $jsProcess.RelPermalink }}" integrity="{{ $jsProcess.Data.Integrity }}"></script> + {{/* Extend footer - eg. for extra scripts, etc. */}} + {{ if templates.Exists "partials/extend-footer.html" }} + {{ partialCached "extend-footer.html" . }} + {{ end }} +</footer>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/functions/date.html b/themes/blowfish/layouts/partials/functions/date.html new file mode 100644 index 0000000..d9ae543 --- /dev/null +++ b/themes/blowfish/layouts/partials/functions/date.html @@ -0,0 +1 @@ +{{ return time.Format (site.Language.Params.dateFormat | default ":date_long") . }} diff --git a/themes/blowfish/layouts/partials/functions/uid.html b/themes/blowfish/layouts/partials/functions/uid.html new file mode 100644 index 0000000..f4269dc --- /dev/null +++ b/themes/blowfish/layouts/partials/functions/uid.html @@ -0,0 +1,13 @@ +{{ $uid := .Page.RelPermalink }} +{{ $ctx := . }} + +{{ range seq 16 }} + {{ with $ctx }} + {{ $uid = printf "%s-%d" $uid .Ordinal }} + {{ $ctx = .Parent }} + {{ else }} + {{ break }} + {{ end }} +{{ end }} + +{{ return md5 $uid }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/head.html b/themes/blowfish/layouts/partials/head.html new file mode 100644 index 0000000..f59e9dc --- /dev/null +++ b/themes/blowfish/layouts/partials/head.html @@ -0,0 +1,149 @@ +<head> + <meta charset="utf-8" /> + {{ with .Site.Language.Params.htmlCode | default .Site.LanguageCode }} + <meta http-equiv="content-language" content="{{ . }}" /> + {{ end }} + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta http-equiv="X-UA-Compatible" content="ie=edge" /> + {{/* Title */}} + {{ if .IsHome -}} + <title>{{ .Site.Title | emojify }}</title> + <meta name="title" content="{{ .Site.Title | emojify }}" /> + {{- else -}} + <title>{{ .Title | emojify }} · {{ .Site.Title | emojify }}</title> + <meta name="title" content="{{ .Title | emojify }} · {{ .Site.Title | emojify }}" /> + {{- end }} + {{/* Metadata */}} + {{ with (.Params.Summary | default .Params.Description) | default .Site.Params.description -}} + <meta name="description" content="{{ . }}" /> + {{- end }} + {{ with .Params.Tags | default .Site.Params.keywords -}} + <meta name="keywords" content="{{ range . }}{{ . }}, {{ end -}}" /> + {{- end }} + {{ with .Site.Params.robots }} + <meta name="robots" content="{{ . }}" /> + {{ end }} + {{ with .Params.robots }} + <meta name="robots" content="{{ . }}" /> + {{ end }} + <link rel="canonical" href="{{ .Permalink }}" /> + {{ range .AlternativeOutputFormats -}} + {{ printf ` + <link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .RelPermalink ($.Site.Title | emojify) | + safeHTML }} + {{ end -}} + {{/* Asset bundles */}} + {{ $assets := newScratch }} + {{ $cssScheme := resources.Get (printf "css/schemes/%s.css" (.Site.Params.colorScheme | default "blowfish")) }} + {{ if not $cssScheme }} + {{ $cssScheme = resources.Get "css/schemes/blowfish.css" }} + {{ end }} + {{ $assets.Add "css" (slice $cssScheme) }} + {{ $cssMain := resources.Get "css/compiled/main.css" }} + {{ $assets.Add "css" (slice $cssMain) }} + {{ $cssCustom := resources.Get "css/custom.css" }} + {{ if $cssCustom }} + {{ $assets.Add "css" (slice $cssCustom) }} + {{ end }} + {{ $bundleCSS := $assets.Get "css" | resources.Concat "css/main.bundle.css" | resources.Minify | resources.Fingerprint + "sha512" }} + <link type="text/css" rel="stylesheet" href="{{ $bundleCSS.RelPermalink }}" + integrity="{{ $bundleCSS.Data.Integrity }}" /> + {{ $jsAppearance := resources.Get "js/appearance.js" }} + {{ $jsAppearance = $jsAppearance | resources.ExecuteAsTemplate "js/appearance.js" . | resources.Minify | resources.Fingerprint "sha512" }} + <script type="text/javascript" src="{{ $jsAppearance.RelPermalink }}" + integrity="{{ $jsAppearance.Data.Integrity }}"></script> + {{ if .Site.Params.enableSearch | default false }} + {{ $jsFuse := resources.Get "lib/fuse/fuse.min.js" }} + {{ $jsSearch := resources.Get "js/search.js" }} + {{ $assets.Add "js" (slice $jsFuse $jsSearch) }} + {{ end }} + {{ if .Site.Params.enableCodeCopy | default false }} + {{ $jsCode := resources.Get "js/code.js" }} + {{ $assets.Add "js" (slice $jsCode) }} + {{ end }} + {{ if .Site.Params.rtl | default false }} + {{ $jsRTL := resources.Get "js/rtl.js" }} + {{ $assets.Add "js" (slice $jsRTL) }} + {{ end }} + {{ if $assets.Get "js" }} + {{ $bundleJS := $assets.Get "js" | resources.Concat "js/main.bundle.js" | resources.Minify | resources.Fingerprint + "sha512" }} + <script defer type="text/javascript" id="script-bundle" src="{{ $bundleJS.RelPermalink }}" + integrity="{{ $bundleJS.Data.Integrity }}" data-copy="{{ i18n " code.copy" }}" data-copied="{{ i18n " code.copied" + }}"></script> + {{ end }} + {{ if not .Site.Params.disableImageZoom | default true }} + <script src="{{ "js/zoom.min.js" | relURL }}"></script> + {{ end }} + {{/* Icons */}} + {{ if templates.Exists "partials/favicons.html" }} + {{ partialCached "favicons.html" .Site }} + {{ else }} + <link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}" /> + <link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | relURL }}" /> + <link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}" /> + <link rel="manifest" href="{{ "site.webmanifest" | relURL }}" /> + {{ end }} + {{/* Site Verification */}} + {{ with .Site.Params.verification.google }} + <meta name="google-site-verification" content="{{ . }}" /> + {{ end }} + {{ with .Site.Params.verification.bing }} + <meta name="msvalidate.01" content="{{ . }}" /> + {{ end }} + {{ with .Site.Params.verification.pinterest }} + <meta name="p:domain_verify" content="{{ . }}" /> + {{ end }} + {{ with .Site.Params.verification.yandex }} + <meta name="yandex-verification" content="{{ . }}" /> + {{ end }} + {{/* Social */}} + {{ template "_internal/opengraph.html" . }} + {{ template "_internal/twitter_cards.html" . }} + {{/* Schema */}} + {{ partial "schema.html" . }} + {{/* Me */}} + {{ with .Site.Author.name }} + <meta name="author" content="{{ . }}" />{{ end }} + {{ with .Site.Author.links }} + {{ range $links := . }} + {{ range $name, $url := $links }} + <link href="{{ $url }}" rel="me" />{{ end }} + {{ end }} + {{ end }} + {{/* Vendor */}} + {{ partial "vendor.html" . }} + {{/* Analytics */}} + {{ partial "analytics/main.html" .Site }} + {{/* Extend head - eg. for custom analytics scripts, etc. */}} + {{ if templates.Exists "partials/extend-head.html" }} + {{ partialCached "extend-head.html" .Site }} + {{ end }} + <meta name="theme-color"/> + {{/* Firebase */}} + {{ with $.Site.Params.firebase }} + {{ if isset $.Site.Params "firebase" }} + <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script> + <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-firestore.js"></script> + <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-auth.js"></script> + <script> + + const firebaseConfig = { + apiKey: {{ $.Site.Params.firebase.apiKey }}, + authDomain: {{ $.Site.Params.firebase.apiKey }}, + projectId: {{ $.Site.Params.firebase.projectId }}, + storageBucket: {{ $.Site.Params.firebase.storageBucket }}, + messagingSenderId: {{ $.Site.Params.firebase.messagingSenderId }}, + appId: {{ $.Site.Params.firebase.appId }}, + measurementId: {{ $.Site.Params.firebase.measurementId }} + }; + + var app = firebase.initializeApp(firebaseConfig); + var db = firebase.firestore(); + var auth = firebase.auth(); + + </script> + {{ end }} + {{ end }} +</head> diff --git a/themes/blowfish/layouts/partials/header/basic.html b/themes/blowfish/layouts/partials/header/basic.html new file mode 100644 index 0000000..3a513c6 --- /dev/null +++ b/themes/blowfish/layouts/partials/header/basic.html @@ -0,0 +1,178 @@ +<div style="padding-left:0;padding-right:0;padding-top:2px;padding-bottom:3px" + class="main-menu flex items-center justify-between px-4 py-6 sm:px-6 md:justify-start space-x-3"> + {{ if .Site.Params.Logo }} + {{ $logo := resources.Get .Site.Params.Logo }} + {{ if $logo }} + <div> + <a href="{{ "" | relLangURL }}" class="flex"> + <span class="sr-only">{{ .Site.Title | markdownify | emojify }}</span> + + <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 }}" /> + + </a> + </div> + {{ end }} + {{- end }} + <div class="flex flex-1 items-center justify-between"> + <nav class="flex space-x-3"> + + {{ if not .Site.Params.disableTextInHeader | default true }} + <a href="{{ "" | relLangURL }}" class="text-base font-medium text-gray-500 hover:text-gray-900">{{ + .Site.Title | markdownify + | emojify }}</a> + {{ end }} + + </nav> + <nav class="hidden md:flex items-center space-x-5 md:ml-12 h-12"> + + {{ if .Site.Menus.main }} + {{ range .Site.Menus.main }} + {{ partial "header/header-option.html" . }} + {{ end }} + {{ end }} + + {{ partial "translations.html" . }} + + {{ if .Site.Params.enableSearch | default false }} + <button id="search-button" aria-label="Search" class="text-base hover:text-primary-600 dark:hover:text-primary-400" + title="{{ i18n " search.open_button_title" }}"> + {{ partial "icon.html" "search" }} + </button> + {{ end }} + + + {{/* Appearance switch */}} + {{ if .Site.Params.footer.showAppearanceSwitcher | default false }} + <div + class="{{ if .Site.Params.footer.showScrollToTop | default true -}} ltr:mr-14 rtl:ml-14 {{- end }} flex items-center"> + <button id="appearance-switcher" aria-label="Dark mode switcher" type="button" class="text-base hover:text-primary-600 dark:hover:text-primary-400"> + <div class="flex items-center justify-center dark:hidden"> + {{ partial "icon.html" "moon" }} + </div> + <div class="items-center justify-center hidden dark:flex"> + {{ partial "icon.html" "sun" }} + </div> + </button> + </div> + {{ end }} + + </nav> + <div class="flex md:hidden items-center space-x-5 md:ml-12 h-12"> + + <span></span> + + {{ partial "translations.html" . }} + + {{ if .Site.Params.enableSearch | default false }} + <button id="search-button-mobile" aria-label="Search" class="text-base hover:text-primary-600 dark:hover:text-primary-400" + title="{{ i18n " search.open_button_title" }}"> + {{ partial "icon.html" "search" }} + </button> + {{ end }} + + {{/* Appearance switch */}} + {{ if .Site.Params.footer.showAppearanceSwitcher | default false }} + <button id="appearance-switcher-mobile" aria-label="Dark mode switcher" type="button" class="text-base hover:text-primary-600 dark:hover:text-primary-400" style="margin-right:5px"> + <div class="flex items-center justify-center dark:hidden"> + {{ partial "icon.html" "moon" }} + </div> + <div class="items-center justify-center hidden dark:flex"> + {{ partial "icon.html" "sun" }} + </div> + </button> + {{ end }} + + </div> + </div> + <div class="-my-2 -mr-2 md:hidden"> + + <label id="menu-button" for="menu-controller" class="block"> + <input type="checkbox" id="menu-controller" class="hidden" /> + {{ if .Site.Menus.main }} + <div class="cursor-pointer hover:text-primary-600 dark:hover:text-primary-400"> + {{ partial "icon.html" "bars" }} + </div> + <div id="menu-wrapper" style="padding-top:5px;" + class="fixed inset-0 z-30 invisible w-screen h-screen m-0 overflow-auto transition-opacity opacity-0 cursor-default bg-neutral-100/50 backdrop-blur-sm dark:bg-neutral-900/50"> + <ul + class="flex space-y-2 mt-3 flex-col items-end w-full px-6 py-6 mx-auto overflow-visible list-none ltr:text-right rtl:text-left max-w-7xl"> + + <li> + <span + class="cursor-pointer inline-block align-text-bottom hover:text-primary-600 dark:hover:text-primary-400">{{ + partial + "icon.html" + "xmark" }}</span> + </li> + + {{ range .Site.Menus.main }} + + {{ partial "header/header-mobile-option.html" . }} + + {{ end }} + + </ul> + {{ if .Site.Menus.subnavigation }} + <hr> + <ul + class="flex mt-4 flex-col items-end w-full px-6 py-6 mx-auto overflow-visible list-none ltr:text-right rtl:text-left max-w-7xl"> + + + {{ range .Site.Menus.subnavigation }} + <li class="mb-1"> + <a href="{{ .URL }}" {{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" + ) }} target="_blank" {{ end }} class="flex items-center"> + {{ if .Pre }} + <span {{ if and .Pre .Name}} class="mr-3" {{ end }}> + {{ partial "icon.html" .Pre }} + </span> + {{ end }} + <p class="text-sm font-sm text-gray-500 hover:text-gray-900" title="{{ .Title }}"> + {{ .Name | markdownify | emojify }} + </p> + </a> + </li> + {{ end }} + + </ul> + {{ end }} + {{ end }} + + </div> + </label> + </div> +</div> + +{{ if .Site.Menus.subnavigation }} +<div class="main-menu flex pb-3 flex-col items-end justify-between md:justify-start space-x-3" {{ if .Site.Params.Logo + }} style="margin-top:-15px" {{ end }}> + <div class="hidden md:flex items-center space-x-5"> + {{ range .Site.Menus.subnavigation }} + <a href="{{ .URL }}" {{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }} + target="_blank" {{ end }} class="flex items-center"> + {{ if .Pre }} + <span {{ if and .Pre .Name}} class="mr-1" {{ end }}> + {{ partial "icon.html" .Pre }} + </span> + {{ end }} + <p class="text-xs font-light text-gray-500 hover:text-gray-900" title="{{ .Title }}"> + {{ .Name | markdownify | emojify }} + </p> + </a> + {{ end }} + </div> +</div> +{{ end }} + +{{ if .Site.Params.highlightCurrentMenuArea }} +<script> + (function () { + var $mainmenu = $('.main-menu'); + var path = window.location.pathname; + $mainmenu.find('a[href="' + path + '"]').each(function (i, e) { + $(e).children('p').addClass('active'); + }); + })(); +</script> +{{ end }} diff --git a/themes/blowfish/layouts/partials/header/fixed-fill-blur.html b/themes/blowfish/layouts/partials/header/fixed-fill-blur.html new file mode 100644 index 0000000..534fe98 --- /dev/null +++ b/themes/blowfish/layouts/partials/header/fixed-fill-blur.html @@ -0,0 +1,14 @@ +<div class="min-h-[148px]"></div> +<div class="fixed inset-x-0 pl-[24px] pr-[24px]" style="z-index:100"> + <div id="menu-blur" class="absolute opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom bg-neutral dark:bg-neutral-800"></div> + <div class="relative max-w-[64rem] ml-auto mr-auto"> + {{ partial "partials/header/basic.html" . }} + </div> +</div> +<script> + window.addEventListener('scroll', function (e) { + var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; + var background_blur = document.getElementById('menu-blur'); + background_blur.style.opacity = (scroll / 300); + }); +</script> diff --git a/themes/blowfish/layouts/partials/header/fixed-fill.html b/themes/blowfish/layouts/partials/header/fixed-fill.html new file mode 100644 index 0000000..4d73a1f --- /dev/null +++ b/themes/blowfish/layouts/partials/header/fixed-fill.html @@ -0,0 +1,6 @@ +<div class="min-h-[148px]"></div> +<div class="fixed inset-x-0 pl-[24px] pr-[24px] bg-neutral dark:bg-neutral-800" style="z-index:100"> + <div class="relative max-w-[64rem] ml-auto mr-auto"> + {{ partial "partials/header/basic.html" . }} + </div> +</div> diff --git a/themes/blowfish/layouts/partials/header/fixed-gradient.html b/themes/blowfish/layouts/partials/header/fixed-gradient.html new file mode 100644 index 0000000..7085b8a --- /dev/null +++ b/themes/blowfish/layouts/partials/header/fixed-gradient.html @@ -0,0 +1,15 @@ +<div class="min-h-[148px]"></div> +<div class="fixed inset-x-0 min-h-[130px] opacity-65 pl-[24px] pr-[24px] bg-gradient-to-b from-neutral from-60% dark:from-neutral-800 to-transparent mix-blend-normal" style="z-index:80"></div> +<div class="fixed inset-x-0 pl-[24px] pr-[24px]" style="z-index:100"> + <div id="menu-blur" class="absolute opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl shadow-2xl"></div> + <div class="relative max-w-[64rem] ml-auto mr-auto"> + {{ partial "partials/header/basic.html" . }} + </div> +</div> +<script> + window.addEventListener('scroll', function (e) { + var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; + var background_blur = document.getElementById('menu-blur'); + background_blur.style.opacity = (scroll / 300); + }); +</script> diff --git a/themes/blowfish/layouts/partials/header/fixed.html b/themes/blowfish/layouts/partials/header/fixed.html new file mode 100644 index 0000000..8e3f64d --- /dev/null +++ b/themes/blowfish/layouts/partials/header/fixed.html @@ -0,0 +1,14 @@ +<div class="min-h-[148px]"></div> +<div class="fixed inset-x-0 pl-[24px] pr-[24px]" style="z-index:100"> + <div id="menu-blur" class="absolute opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl shadow-2xl"></div> + <div class="relative max-w-[64rem] ml-auto mr-auto"> + {{ partial "partials/header/basic.html" . }} + </div> +</div> +<script> + window.addEventListener('scroll', function (e) { + var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; + var background_blur = document.getElementById('menu-blur'); + background_blur.style.opacity = (scroll / 300); + }); +</script> diff --git a/themes/blowfish/layouts/partials/header/header-mobile-option-nested.html b/themes/blowfish/layouts/partials/header/header-mobile-option-nested.html new file mode 100644 index 0000000..04c3e6d --- /dev/null +++ b/themes/blowfish/layouts/partials/header/header-mobile-option-nested.html @@ -0,0 +1,31 @@ +<li class="mt-1"> + <a class="flex items-center text-gray-500 hover:text-primary-600 dark:hover:text-primary-400"> + {{ if .Pre }} + <span {{ if and .Pre .Name}} class="mr-1" {{ end }}> + {{ partial "icon.html" .Pre }} + </span> + {{ end }} + <p class="text-bg font-bg" title="{{ .Title }}"> + {{ .Name | markdownify | emojify }} + </p> + <span> + {{ partial "icon.html" "chevron-down" }} + </span> + </a> +</li> +{{ range .Children }} +<li class="mt-1"> + <a href="{{ .URL }}" {{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" + ) }} target="_blank" {{ end }} class="flex items-center text-gray-500 hover:text-primary-600 dark:hover:text-primary-400"> + {{ if .Pre }} + <span {{ if and .Pre .Name}} class="mr-1" {{ end }}> + {{ partial "icon.html" .Pre }} + </span> + {{ end }} + <p class="text-sm font-small" title="{{ .Title }}"> + {{ .Name | markdownify | emojify }} + </p> + </a> +</li> +{{ end }} +<li class="mb-2"></li>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/header/header-mobile-option-simple.html b/themes/blowfish/layouts/partials/header/header-mobile-option-simple.html new file mode 100644 index 0000000..e4d2d64 --- /dev/null +++ b/themes/blowfish/layouts/partials/header/header-mobile-option-simple.html @@ -0,0 +1,13 @@ +<li class="mt-1"> + <a href="{{ .URL }}" {{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" + ) }} target="_blank" {{ end }} class="flex items-center text-gray-500 hover:text-primary-600 dark:hover:text-primary-400"> + {{ if .Pre }} + <div {{ if and .Pre .Name}} class="mr-2" {{ end }}> + {{ partial "icon.html" .Pre }} + </div> + {{ end }} + <p class="text-bg font-bg" title="{{ .Title }}"> + {{ .Name | markdownify | emojify }} + </p> + </a> +</li>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/header/header-mobile-option.html b/themes/blowfish/layouts/partials/header/header-mobile-option.html new file mode 100644 index 0000000..1703119 --- /dev/null +++ b/themes/blowfish/layouts/partials/header/header-mobile-option.html @@ -0,0 +1,5 @@ +{{ if .HasChildren }} + {{ partial "header/header-mobile-option-nested.html" . }} +{{ else }} + {{ partial "header/header-mobile-option-simple.html" . }} +{{ end }} diff --git a/themes/blowfish/layouts/partials/header/header-option-nested.html b/themes/blowfish/layouts/partials/header/header-option-nested.html new file mode 100644 index 0000000..b86fed6 --- /dev/null +++ b/themes/blowfish/layouts/partials/header/header-option-nested.html @@ -0,0 +1,35 @@ +<div> + <div class="cursor-pointer flex items-center nested-menu"> + {{ if .Pre }} + <span {{ if and .Pre .Name}} class="mr-1" {{ end }}> + {{ partial "icon.html" .Pre }} + </span> + {{ end }} + <a {{ if .URL }} href="{{ .URL }}" {{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }} + target="_blank" {{ end }} {{ end }} class="text-base font-medium text-gray-500 hover:text-primary-600 dark:hover:text-primary-400" title="{{ .Title }}"> + {{ .Name | markdownify | emojify }} + </a> + <span> + {{ partial "icon.html" "chevron-down" }} + </span> + </div> + <div class="absolute menuhide"> + <div class="pt-2 p-5 mt-2 rounded-xl backdrop-blur shadow-2xl"> + <div class="flex flex-col space-y-3"> + {{ range .Children }} + <a href="{{ .URL }}" {{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }} + target="_blank" {{ end }} class="flex items-center text-gray-500 hover:text-primary-600 dark:hover:text-primary-400"> + {{ if .Pre }} + <span {{ if and .Pre .Name}} class="mr-1" {{ end }}> + {{ partial "icon.html" .Pre }} + </span> + {{ end }} + <p class="text-sm font-sm" title="{{ .Title }}"> + {{ .Name | markdownify | emojify }} + </p> + </a> + {{ end }} + </div> + </div> + </div> +</div> diff --git a/themes/blowfish/layouts/partials/header/header-option-simple.html b/themes/blowfish/layouts/partials/header/header-option-simple.html new file mode 100644 index 0000000..9ce01b8 --- /dev/null +++ b/themes/blowfish/layouts/partials/header/header-option-simple.html @@ -0,0 +1,11 @@ +<a href="{{ .URL }}" {{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }} target="_blank" {{ + end }} class="flex items-center text-gray-500 hover:text-primary-600 dark:hover:text-primary-400"> + {{ if .Pre }} + <span {{ if and .Pre .Name}} class="mr-1" {{ end }}> + {{ partial "icon.html" .Pre }} + </span> + {{ end }} + <p class="text-base font-medium" title="{{ .Title }}"> + {{ .Name | markdownify | emojify }} + </p> +</a>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/header/header-option.html b/themes/blowfish/layouts/partials/header/header-option.html new file mode 100644 index 0000000..2a27da7 --- /dev/null +++ b/themes/blowfish/layouts/partials/header/header-option.html @@ -0,0 +1,5 @@ +{{ if .HasChildren }} + {{ partial "header/header-option-nested.html" . }} +{{ else }} + {{ partial "header/header-option-simple.html" . }} +{{ end }} diff --git a/themes/blowfish/layouts/partials/hero/background.html b/themes/blowfish/layouts/partials/hero/background.html new file mode 100644 index 0000000..1f6e3fb --- /dev/null +++ b/themes/blowfish/layouts/partials/hero/background.html @@ -0,0 +1,66 @@ +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} + +{{- $images := .Resources.ByType "image" -}} +{{- $featured := $images.GetMatch "*background*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} + +{{ if and .Params.featureimage (not $featured) }} +{{- $url:= .Params.featureimage -}} +{{ $featured = resources.GetRemote $url }} +{{ end }} + +{{- if not $featured }} + {{ with .Site.Params.defaultBackgroundImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $featured = resources.GetRemote . }} + {{ else }} + {{ $featured = resources.Get . }} + {{ end }} + {{ end }} +{{ end -}} + +{{ $isParentList := eq (.Scratch.Get "scope") "list" }} +{{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or + (and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList)) + (and ($.Site.Params.list.layoutBackgroundBlur | default true) ($isParentList)) + ) }} +{{ $shouldAddHeaderSpace := $.Params.layoutBackgroundHeaderSpace | default (or + (and ($.Site.Params.article.layoutBackgroundHeaderSpace | default true) (not $isParentList)) + (and ($.Site.Params.list.layoutBackgroundHeaderSpace | default true) ($isParentList)) + ) }} +{{- with $featured -}} + +{{ if $shouldAddHeaderSpace | default true}} +<div id="hero" class="h-[150px] md:h-[200px]"></div> +{{ end }} + +{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}} + {{ with . }} + <div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom" + style="background-image:url({{ .RelPermalink }});"> + {{ end }} +{{ else }} + {{ with .Resize "1200x" }} + <div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom" + style="background-image:url({{ .RelPermalink }});"> + {{ end }} +{{ end }} + + <div class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"> + </div> + <div + class="absolute inset-0 opacity-60 bg-gradient-to-t from-neutral dark:from-neutral-800 to-neutral-100 dark:to-neutral-800 mix-blend-normal"> + </div> +</div> +{{ if $shouldBlur | default false }} +<div id="background-blur" class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl"></div> +<script> + window.addEventListener('scroll', function (e) { + var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; + var background_blur = document.getElementById('background-blur'); + background_blur.style.opacity = (scroll / 300) + }); +</script> +{{ end }} +{{- end -}} diff --git a/themes/blowfish/layouts/partials/hero/basic.html b/themes/blowfish/layouts/partials/hero/basic.html new file mode 100644 index 0000000..4d01bb2 --- /dev/null +++ b/themes/blowfish/layouts/partials/hero/basic.html @@ -0,0 +1,33 @@ +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} + +{{- $images := .Resources.ByType "image" -}} +{{- $featured := $images.GetMatch "*background*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} + +{{ if and .Params.featureimage (not $featured) }} +{{- $url:= .Params.featureimage -}} +{{ $featured = resources.GetRemote $url }} +{{ end }} + +{{- if not $featured }} + {{ with .Site.Params.defaultBackgroundImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $featured = resources.GetRemote . }} + {{ else }} + {{ $featured = resources.Get . }} + {{ end }} + {{ end }} +{{ end -}} + +{{- with $featured -}} + {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}} + {{ with . }} + <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" }} + <div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ end }} +{{- end -}}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/hero/big.html b/themes/blowfish/layouts/partials/hero/big.html new file mode 100644 index 0000000..4b61b83 --- /dev/null +++ b/themes/blowfish/layouts/partials/hero/big.html @@ -0,0 +1,60 @@ +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} + +{{- $images := .Resources.ByType "image" -}} +{{- $featured := $images.GetMatch "*background*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} + +{{ if .Params.featureimage }} +{{- $url:= .Params.featureimage -}} +{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}} +{{ end }} + +{{- if not $featured }} + {{ with .Site.Params.defaultBackgroundImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $featured = resources.GetRemote . }} + {{ else }} + {{ $featured = resources.Get . }} + {{ end }} + {{ end }} +{{ end -}} + +{{ $caption := "" }} +{{ if .Params.featureimagecaption }} +{{- $caption = .Params.featureimagecaption -}} +{{ end }} + +{{- $alt := .Page.Title -}} +{{- with .Page.Params.alt }}{{ $alt = . }}{{ end -}} + +{{- with $featured -}} + {{ if strings.HasSuffix $featured ".svg" }} + {{ with . }} + <figure> + <img class="w-full rounded-lg single_hero_round nozoom" alt="{{ $alt }}" src="{{ .RelPermalink }}"> + {{ if $caption }} + <figcaption class="text-sm text-neutral-700 dark:text-neutral-400 hover:underline" style="text-align: center;"> {{ $caption | markdownify }} </figcaption> + {{end}} + </figure> + {{ end }} + {{ else if $disableImageOptimization }} + {{ with . }} + <figure> + <img class="w-full rounded-lg single_hero_round nozoom" alt="{{ $alt }}" width="{{ .Width }}" height="{{ .Height }}" src="{{ .RelPermalink }}"> + {{ if $caption }} + <figcaption class="text-sm text-neutral-700 dark:text-neutral-400 hover:underline" style="text-align: center;"> {{ $caption | markdownify }} </figcaption> + {{end}} + </figure> + {{ end }} + {{ else }} + {{ with .Resize "1200x" }} + <figure> + <img class="w-full rounded-lg single_hero_round nozoom" alt="{{ $alt }}" width="{{ .Width }}" height="{{ .Height }}" src="{{ .RelPermalink }}"> + {{ if $caption }} + <figcaption class="text-sm text-neutral-700 dark:text-neutral-400 hover:underline" style="text-align: center;"> {{ $caption | markdownify }} </figcaption> + {{end}} + </figure> + {{ end }} + {{ end }} +{{- end -}}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/hero/thumbAndBackground.html b/themes/blowfish/layouts/partials/hero/thumbAndBackground.html new file mode 100644 index 0000000..4b807ac --- /dev/null +++ b/themes/blowfish/layouts/partials/hero/thumbAndBackground.html @@ -0,0 +1,70 @@ +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} + +{{- $images := .Resources.ByType "image" -}} +{{- $background := $images.GetMatch "*background*" -}} +{{- if not $background }}{{ with .Site.Params.defaultBackgroundImage }}{{ $background = resources.Get . }}{{ end }}{{ end -}} +{{- if not $background }}{{ $background = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} +{{- if not $background }}{{ $background = $images.GetMatch "*feature*" }}{{ end -}} +{{- $featured := $images.GetMatch "*feature*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} +{{ if .Params.featureimage }} +{{- $url:= .Params.featureimage -}} +{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}} +{{ end }} +{{- if not $featured }}{{ $featured = $images.GetMatch "*background*" }}{{ end -}} +{{- if not $featured }}{{ with .Site.Params.defaultBackgroundImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} +{{ $isParentList := eq (.Scratch.Get "scope") "list" }} +{{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or + (and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList)) + (and ($.Site.Params.list.layoutBackgroundBlur | default true) ($isParentList)) + ) }} + +{{- with $featured -}} +{{ if or $disableImageOptimization (strings.HasSuffix . ".svg")}} +{{ with . }} +<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" }} +<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 }} +{{- end -}} + +{{- with $background -}} + +{{ if or $disableImageOptimization (strings.HasSuffix . ".svg")}} +{{ with . }} +<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"> + </div> + <div + class="absolute inset-0 opacity-30 dark:opacity-60 bg-gradient-to-t from-neutral dark:from-neutral-800 to-neutral dark:to-neutral-800 mix-blend-normal"> + </div> +</div>{{ end }} +{{ else }} +{{ with .Resize "1200x" }} +<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"> + </div> + <div + class="absolute inset-0 opacity-30 dark:opacity-60 bg-gradient-to-t from-neutral dark:from-neutral-800 to-neutral dark:to-neutral-800 mix-blend-normal"> + </div> +</div>{{ end }} +{{ end }} + +{{- end -}} + +{{ if $shouldBlur | default false }} +<div id="background-blur" class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl"></div> +<script> + window.addEventListener('scroll', function (e) { + var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; + var background_blur = document.getElementById('background-blur'); + background_blur.style.opacity = (scroll / 300) + }); +</script> +{{ end }} + diff --git a/themes/blowfish/layouts/partials/home/background.html b/themes/blowfish/layouts/partials/home/background.html new file mode 100644 index 0000000..2549033 --- /dev/null +++ b/themes/blowfish/layouts/partials/home/background.html @@ -0,0 +1,88 @@ +{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} +<article class="max-w-full prose dark:prose-invert"> + <div class="relative"> + <div class="absolute inset-x-0 bottom-0 h-1/2 bg-gray-100"></div> + <div class="mx-auto max-w-7xl p-0"> + <div class="relative sm:overflow-hidden"> + <div class="fixed inset-x-0 top-0" style="z-index:-10"> + {{ $homepageImage := "" }} + {{ with .Site.Params.defaultBackgroundImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $homepageImage = resources.GetRemote . }} + {{ else }} + {{ $homepageImage = resources.Get . }} + {{ end }} + {{ end }} + {{ with .Site.Params.homepage.homepageImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $homepageImage = resources.GetRemote . }} + {{ else }} + {{ $homepageImage = resources.Get . }} + {{ end }} + {{ end }} + {{ if $homepageImage }} + <img class="w-full h-[1000px] object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}" role="presentation"> + <div + class="absolute inset-0 h-[1000px] bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"> + </div> + <div + class="opacity-60 absolute inset-0 h-[1000px] bg-gradient-to-t from-neutral dark:from-neutral-800 to-neutral-100 dark:to-neutral-800 mix-blend-normal"> + </div> + {{ end }} + </div> + <div class="relative px-1 py-1 flex flex-col items-center justify-center text-center"> + {{ with .Site.Author.image }} + {{ $authorImage := "" }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $authorImage = resources.GetRemote . }} + {{ else }} + {{ $authorImage = resources.Get . }} + {{ end }} + {{ if $authorImage }} + {{ if not $disableImageOptimization }} + {{ $authorImage = $authorImage.Fill "288x288" }} + {{ end }} + <img class="mb-2 rounded-full h-36 w-36" width="144" height="144" + alt="{{ $.Site.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 }} + </h1> + {{ with .Site.Author.headline }} + <h2 class="mt-0 mb-0 text-xl text-neutral-800 dark:text-neutral-300"> + {{ . | markdownify | emojify }} + </h2> + {{ end }} + <div class="mt-3 mb-10 text-2xl"> + {{ with .Site.Author.links }} + <div class="flex flex-wrap"> + {{ range $links := . }} + {{ range $name, $url := $links }} + <a class="px-1 hover:text-primary-400 text-primary-800 dark:text-primary-200" href="{{ $url }}" target="_blank" + aria-label="{{ $name | title }}" rel="me noopener noreferrer">{{ partial + "icon.html" $name }}</a> + {{ end }} + {{ end }} + </div> + {{ end }} + </div> + <section class="prose dark:prose-invert">{{ .Content | emojify }}</section> + </div> + </div> + </div> + </div> +</article> +<section> + {{ partial "recent-articles/main.html" . }} +</section> +{{ if .Site.Params.homepage.layoutBackgroundBlur | default false }} +<div id="background-blur" class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl"></div> +<script> + window.addEventListener('scroll', function (e) { + var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; + var background_blur = document.getElementById('background-blur'); + background_blur.style.opacity = (scroll / 300) + }); +</script> +{{ end }} diff --git a/themes/blowfish/layouts/partials/home/card.html b/themes/blowfish/layouts/partials/home/card.html new file mode 100644 index 0000000..0b17f83 --- /dev/null +++ b/themes/blowfish/layouts/partials/home/card.html @@ -0,0 +1,43 @@ +<div class="relative pt-16 pb-32"> + <div aria-hidden="true" class="absolute inset-x-0 top-0 h-48 bg-gradient-to-b from-gray-100"></div> + <div class="relative"> + <div class="lg:mx-auto lg:grid lg:max-w-7xl lg:grid-flow-col-dense lg:grid-cols-2 lg:gap-24 lg:px-8"> + <div class="mx-auto max-w-xl px-4 sm:px-6 lg:mx-0 lg:max-w-none lg:py-16 lg:px-0"> + <article class="max-w-full prose dark:prose-invert"> + {{ with .Title }} + <header> + <h1>{{ . | emojify }}</h1> + </header> + {{ end }} + <section>{{ .Content | emojify }}</section> + </article> + </div> + <div class="mt-6 sm:mt-16 lg:mt-0 mx-auto max-w-xl px-4 sm:px-6 lg:mx-0 lg:max-w-none lg:py-16 lg:px-0"> + <div class="-mr-48 md:-mr-16 lg:relative lg:m-0 lg:h-full lg:px-0" style="width:100%"> + {{ $homepageImage := "" }} + {{ with .Site.Params.defaultBackgroundImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $homepageImage = resources.GetRemote . }} + {{ else }} + {{ $homepageImage = resources.Get . }} + {{ end }} + {{ end }} + {{ with .Site.Params.homepage.homepageImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $homepageImage = resources.GetRemote . }} + {{ else }} + {{ $homepageImage = resources.Get . }} + {{ end }} + {{ end }} + {{ if $homepageImage }} + <img class="w-full rounded-xl shadow-xl lg:absolute lg:left-0 lg:h-full lg:w-auto lg:max-w-none" + src="{{ $homepageImage.RelPermalink }}"> + {{ end }} + </div> + </div> + </div> + </div> +</div> +<section> + {{ partial "recent-articles/main.html" . }} +</section>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/home/hero.html b/themes/blowfish/layouts/partials/home/hero.html new file mode 100644 index 0000000..cb5933d --- /dev/null +++ b/themes/blowfish/layouts/partials/home/hero.html @@ -0,0 +1,75 @@ +{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} +<article class="max-w-full prose dark:prose-invert"> + <div class="relative"> + <div class="absolute inset-x-0 bottom-0 h-1/2 bg-gray-100"></div> + <div class="mx-auto max-w-7xl p-0"> + <div class="relative shadow-xl sm:overflow-hidden rounded-2xl"> + <div class="absolute inset-0"> + {{ $homepageImage := "" }} + {{ with .Site.Params.defaultBackgroundImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $homepageImage = resources.GetRemote . }} + {{ else }} + {{ $homepageImage = resources.Get . }} + {{ end }} + {{ end }} + {{ with .Site.Params.homepage.homepageImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $homepageImage = resources.GetRemote . }} + {{ else }} + {{ $homepageImage = resources.Get . }} + {{ end }} + {{ end }} + {{ if $homepageImage }} + <img class="h-full w-full object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}"> + <div + class="absolute inset-0 bg-gradient-to-r from-primary-500 to-secondary-600 dark:from-primary-600 dark:to-secondary-800 mix-blend-multiply"> + </div> + {{ 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 }} + {{ $authorImage := "" }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $authorImage = resources.GetRemote . }} + {{ else }} + {{ $authorImage = resources.Get . }} + {{ end }} + {{ if $authorImage }} + {{ if not $disableImageOptimization }} + {{ $authorImage = $authorImage.Fill "288x288" }} + {{ end }} + <img class="mb-2 rounded-full h-36 w-36" width="144" height="144" + alt="{{ $.Site.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 }} + </h1> + {{ with .Site.Author.headline }} + <h2 class="mt-0 mb-0 text-xl text-neutral-300"> + {{ . | markdownify | emojify }} + </h2> + {{ end }} + <div class="mt-3 mb-10 text-2xl"> + {{ with .Site.Author.links }} + <div class="flex flex-wrap"> + {{ range $links := . }} + {{ range $name, $url := $links }} + <a class="px-1 hover:text-primary-400 text-primary-300" href="{{ $url }}" target="_blank" + aria-label="{{ $name | title }}" rel="me noopener noreferrer">{{ partial + "icon.html" $name }}</a> + {{ end }} + {{ end }} + </div> + {{ end }} + </div> + <section class="prose prose-invert">{{ .Content | emojify }}</section> + </div> + </div> + </div> + </div> +</article> +<section> + {{ partial "recent-articles/main.html" . }} +</section> diff --git a/themes/blowfish/layouts/partials/home/page.html b/themes/blowfish/layouts/partials/home/page.html new file mode 100644 index 0000000..d715b78 --- /dev/null +++ b/themes/blowfish/layouts/partials/home/page.html @@ -0,0 +1,11 @@ +<article class="max-w-full prose dark:prose-invert"> + {{ with .Title }} + <header> + <h1>{{ . | emojify }}</h1> + </header> + {{ end }} + <section>{{ .Content | emojify }}</section> +</article> +<section> + {{ partial "recent-articles/main.html" . }} +</section> diff --git a/themes/blowfish/layouts/partials/home/profile.html b/themes/blowfish/layouts/partials/home/profile.html new file mode 100644 index 0000000..70e4ac9 --- /dev/null +++ b/themes/blowfish/layouts/partials/home/profile.html @@ -0,0 +1,37 @@ +{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} +<article class="{{ if not .Site.Params.homepage.showRecent }} + 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 }} + {{ $authorImage := "" }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $authorImage = resources.GetRemote . }} + {{ else }} + {{ $authorImage = resources.Get . }} + {{ end }} + {{ if $authorImage }} + {{ if not $disableImageOptimization }} + {{ $authorImage = $authorImage.Fill "288x288" }} + {{ end }} + <img class="mb-2 rounded-full h-36 w-36" width="144" height="144" alt="{{ $.Site.Author.name | default " Author" }}" + src="{{ $authorImage.RelPermalink }}" /> + {{ end }} + {{ end }} + <h1 class="text-4xl font-extrabold"> + {{ .Site.Author.name | default .Site.Title }} + </h1> + {{ with .Site.Author.headline }} + <h2 class="text-xl text-neutral-500 dark:text-neutral-400"> + {{ . | markdownify | emojify }} + </h2> + {{ end }} + <div class="mt-1 text-2xl"> + {{ partialCached "author-links.html" . }} + </div> + </header> + <section class="prose dark:prose-invert">{{ .Content | emojify }}</section> +</article> +<section> + {{ partial "recent-articles/main.html" . }} +</section>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/icon.html b/themes/blowfish/layouts/partials/icon.html new file mode 100644 index 0000000..150dc92 --- /dev/null +++ b/themes/blowfish/layouts/partials/icon.html @@ -0,0 +1,6 @@ +{{ $icon := resources.Get (print "icons/" . ".svg") }} +{{ if $icon }} + <span class="relative block icon"> + {{ $icon.Content | safeHTML }} + </span> +{{ end }} diff --git a/themes/blowfish/layouts/partials/meta/date-updated.html b/themes/blowfish/layouts/partials/meta/date-updated.html new file mode 100644 index 0000000..cc25c69 --- /dev/null +++ b/themes/blowfish/layouts/partials/meta/date-updated.html @@ -0,0 +1,4 @@ +<time datetime="{{ . }}"> + {{- i18n "article.date_updated" (dict "Date" (partial "functions/date.html" .)) | markdownify | emojify -}} +</time> +{{- /* Trim EOF */ -}} diff --git a/themes/blowfish/layouts/partials/meta/date.html b/themes/blowfish/layouts/partials/meta/date.html new file mode 100644 index 0000000..654a6c7 --- /dev/null +++ b/themes/blowfish/layouts/partials/meta/date.html @@ -0,0 +1,4 @@ +<time datetime="{{ . }}"> + {{- i18n "article.date" (dict "Date" (partial "functions/date.html" .)) | markdownify | emojify -}} +</time> +{{- /* Trim EOF */ -}} diff --git a/themes/blowfish/layouts/partials/meta/edit.html b/themes/blowfish/layouts/partials/meta/edit.html new file mode 100644 index 0000000..7cd1a43 --- /dev/null +++ b/themes/blowfish/layouts/partials/meta/edit.html @@ -0,0 +1,19 @@ +{{ $url := .Params.editURL | default (.Site.Params.article.editURL | default "#") }} +{{ $slash := "" }} +{{ if .Params.editAppendPath | default ( .Site.Params.article.editAppendPath | default false ) }} + {{ if ne (substr $url -1 1) "/" }} + {{ $slash = "/" }} + {{ end }} + {{ $url = printf "%s%s%s" $url $slash (path.Join .File.Path) }} +{{ end }} +<span class="mb-[2px]"> + <a + href="{{ $url }}" + class="text-lg hover:text-primary-500" + rel="noopener noreferrer" + target="_blank" + title="{{ i18n "article.edit_title" }}" + ><span class="inline-block align-text-bottom">{{ partial "icon.html" "edit" }}</span></a + > +</span> +{{- /* Trim EOF */ -}} diff --git a/themes/blowfish/layouts/partials/meta/likes.html b/themes/blowfish/layouts/partials/meta/likes.html new file mode 100644 index 0000000..9cb5ff6 --- /dev/null +++ b/themes/blowfish/layouts/partials/meta/likes.html @@ -0,0 +1,22 @@ +<span> + {{ $id := "null" }} + {{ if eq .Kind "taxonomy" }} + {{ $id = delimit (slice "likes_taxonomy_" .Page.Data.Plural) "" }} + {{ else if eq .Kind "term" }} + {{ $id = delimit (slice "likes_term_" .Page.Data.Term) "" }} + {{ else }} + {{ $translations := .AllTranslations }} + {{ with .File }} + {{ $path := .Path }} + {{range $translations}} + {{ $lang := print "." .Lang ".md" }} + {{ $path = replace $path $lang ".md" }} + {{end}} + {{ $id = delimit (slice "likes_" $path) "" }} + {{ end }} + {{ end }} + <span id="{{ $id }}" + class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400" + title="likes">loading</span> + <span class="inline-block align-text-bottom">{{ partial "icon.html" "heart" }}</span> +</span>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/meta/likes_button.html b/themes/blowfish/layouts/partials/meta/likes_button.html new file mode 100644 index 0000000..09c3c15 --- /dev/null +++ b/themes/blowfish/layouts/partials/meta/likes_button.html @@ -0,0 +1,10 @@ +<span> + <button id="button_likes" + class="rounded-md border border-primary-400 px-1 py-[1px] text-xs font-normal text-primary-700 dark:border-primary-600 dark:text-primary-400" + onclick="process_article()"> + <span id="button_likes_heart" style="display:none" class="inline-block align-text-bottom">{{ partial "icon.html" "heart" }} </span> + <span id="button_likes_emtpty_heart" class="inline-block align-text-bottom">{{ partial "icon.html" "heart-empty" }}</span> + <span id="button_likes_text"> Like</span> + </button> +</span> +{{- /* Trim EOF */ -}}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/meta/reading-time.html b/themes/blowfish/layouts/partials/meta/reading-time.html new file mode 100644 index 0000000..71e706d --- /dev/null +++ b/themes/blowfish/layouts/partials/meta/reading-time.html @@ -0,0 +1,4 @@ +<span title="{{ i18n "article.reading_time_title" }}"> + {{- i18n "article.reading_time" .ReadingTime | markdownify | emojify -}} +</span> +{{- /* Trim EOF */ -}} diff --git a/themes/blowfish/layouts/partials/meta/views.html b/themes/blowfish/layouts/partials/meta/views.html new file mode 100644 index 0000000..fc4a386 --- /dev/null +++ b/themes/blowfish/layouts/partials/meta/views.html @@ -0,0 +1,20 @@ +<span> + {{ $id := "null" }} + {{ if eq .Kind "taxonomy" }} + {{ $id = delimit (slice "views_taxonomy_" .Page.Data.Plural) "" }} + {{ else if eq .Kind "term" }} + {{ $id = delimit (slice "views_term_" .Page.Data.Term) "" }} + {{ else }} + {{ $translations := .AllTranslations }} + {{ with .File }} + {{ $path := .Path }} + {{range $translations}} + {{ $lang := print "." .Lang ".md" }} + {{ $path = replace $path $lang ".md" }} + {{end}} + {{ $id = delimit (slice "views_" $path) "" }} + {{ end }} + {{ end }} + <span id="{{ $id }}" class="animate-pulse inline-block text-transparent max-h-3 rounded-full mt-[-2px] align-middle bg-neutral-300 dark:bg-neutral-400" title="views">loading</span> + <span class="inline-block align-text-bottom">{{ partial "icon.html" "eye" }}</span> +</span>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/meta/word-count.html b/themes/blowfish/layouts/partials/meta/word-count.html new file mode 100644 index 0000000..517101a --- /dev/null +++ b/themes/blowfish/layouts/partials/meta/word-count.html @@ -0,0 +1,4 @@ +<span> + {{- i18n "article.word_count" .WordCount | markdownify | emojify -}} +</span> +{{- /* Trim EOF */ -}} diff --git a/themes/blowfish/layouts/partials/meta/zen-mode.html b/themes/blowfish/layouts/partials/meta/zen-mode.html new file mode 100644 index 0000000..6339e26 --- /dev/null +++ b/themes/blowfish/layouts/partials/meta/zen-mode.html @@ -0,0 +1,14 @@ +{{ $jsZenMode := resources.Get "js/zen-mode.js" }} +{{ $jsZenMode = $jsZenMode | resources.Minify | resources.Fingerprint "sha512" }} + +<script type="text/javascript" src="{{ $jsZenMode.RelPermalink }}" integrity="{{ $jsZenMode.Data.Integrity }}"></script> + +<span class="mb-[2px]"> + <span id="zen-mode-button" + class="text-lg hover:text-primary-500" + title="{{ i18n "article.zen_mode_title.enable" }}" + data-title-i18n-disable="{{ i18n "article.zen_mode_title.enable" }}" + data-title-i18n-enable="{{ i18n "article.zen_mode_title.disable" }}"> + <span class="inline-block align-text-bottom">{{ partial "icon.html" "expand" }}</span> + </span> +</span>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/pagination.html b/themes/blowfish/layouts/partials/pagination.html new file mode 100644 index 0000000..c523313 --- /dev/null +++ b/themes/blowfish/layouts/partials/pagination.html @@ -0,0 +1,49 @@ +{{- if gt .Paginator.TotalPages 1 -}} + <ul class="flex flex-row mt-8 justify-center"> + {{- .Scratch.Set "paginator.ellipsed" false -}} + {{ if $.Paginator.HasPrev }} + <li> + <a + href="{{ $.Paginator.Prev.URL }}" + class="mx-1 block min-w-[1.8rem] rounded text-center hover:bg-primary-600 hover:text-neutral" + rel="prev" + >←</a> + </li> + {{ end }} + {{- range $.Paginator.Pagers -}} + {{- $right := sub .TotalPages .PageNumber -}} + {{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}} + {{- $showNumber := or $showNumber (and (gt .PageNumber (sub $.Paginator.PageNumber 3)) (lt .PageNumber (add $.Paginator.PageNumber 3))) -}} + {{- if $showNumber -}} + {{- $.Scratch.Set "paginator.ellipsed" false -}} + {{- $.Scratch.Set "paginator.shouldEllipse" false -}} + {{- else -}} + {{- $.Scratch.Set "paginator.shouldEllipse" (not ($.Scratch.Get "paginator.ellipsed") ) -}} + {{- $.Scratch.Set "paginator.ellipsed" true -}} + {{- end -}} + {{- if $showNumber -}} + <li> + <a + href="{{ .URL }}" + class="{{ if eq . $.Paginator }} + bg-primary-200 dark:bg-primary-400 dark:text-neutral-800 + {{ end }} mx-1 block min-w-[1.8rem] rounded text-center hover:bg-primary-600 hover:text-neutral" + >{{ .PageNumber }}</a> + </li> + {{- else if ($.Scratch.Get "paginator.shouldEllipse") -}} + <li class="page-item "> + <span class="page-link" aria-hidden="true">…</span> + </li> + {{- end -}} + {{- end -}} + {{ if $.Paginator.HasNext }} + <li> + <a + href="{{ $.Paginator.Next.URL }}" + class="mx-1 block min-w-[1.8rem] rounded text-center hover:bg-primary-600 hover:text-neutral" + rel="next" + >→</a> + </li> + {{ end }} + </ul> +{{- end -}}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/recent-articles/cardview-fullwidth.html b/themes/blowfish/layouts/partials/recent-articles/cardview-fullwidth.html new file mode 100644 index 0000000..7551e17 --- /dev/null +++ b/themes/blowfish/layouts/partials/recent-articles/cardview-fullwidth.html @@ -0,0 +1,12 @@ +{{ $recentArticles := 5 }} +{{ $recentArticles = .Site.Params.homepage.showRecentItems }} + +<div class="relative w-screen max-w-[1600px] px-[30px]" style="left: calc(max(-50vw,-800px) + 50%);"> + <section + class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5"> + {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" + .Site.Params.mainSections)).Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} + </section> +</div>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/recent-articles/cardview.html b/themes/blowfish/layouts/partials/recent-articles/cardview.html new file mode 100644 index 0000000..9da7177 --- /dev/null +++ b/themes/blowfish/layouts/partials/recent-articles/cardview.html @@ -0,0 +1,9 @@ +{{ $recentArticles := 5 }} +{{ $recentArticles = .Site.Params.homepage.showRecentItems }} + +<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3"> + {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" + .Site.Params.mainSections)).Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} +</section>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/recent-articles/list.html b/themes/blowfish/layouts/partials/recent-articles/list.html new file mode 100644 index 0000000..4e32dc5 --- /dev/null +++ b/themes/blowfish/layouts/partials/recent-articles/list.html @@ -0,0 +1,9 @@ +{{ $recentArticles := 5 }} +{{ $recentArticles = .Site.Params.homepage.showRecentItems }} + +<section class="space-y-10 w-full"> + {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages + }} + {{ partial "article-link/simple.html" . }} + {{ end }} +</section>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/recent-articles/main.html b/themes/blowfish/layouts/partials/recent-articles/main.html new file mode 100644 index 0000000..8addb36 --- /dev/null +++ b/themes/blowfish/layouts/partials/recent-articles/main.html @@ -0,0 +1,30 @@ +{{ $recentArticles := 5 }} +{{ $showMoreLinkDest := "/posts" }} +{{ if .Site.Params.homepage.showRecent | default false }} +{{ if index .Site.Params.homepage "showRecentItems" }} +{{ $recentArticles = .Site.Params.homepage.showRecentItems }} +{{ end }} +<h2 class="mt-8 text-2xl font-extrabold mb-10">{{ i18n "shortcode.recent_articles" | emojify }}</h2> + +{{ if and .Site.Params.homepage.cardView (not .Site.Params.homepage.cardViewScreenWidth) | default false }} + {{ partial "recent-articles/cardview.html" . }} +{{ else if and .Site.Params.homepage.cardView .Site.Params.homepage.cardViewScreenWidth | default false }} + {{ partial "recent-articles/cardview-fullwidth.html" . }} +{{ else }} + {{ partial "recent-articles/list.html" . }} +{{ end }} + +{{ if .Site.Params.homepage.showMoreLink | default false }} +{{ if index .Site.Params.homepage "showRecentItems" }} +{{ $showMoreLinkDest = .Site.Params.homepage.showMoreLinkDest }} +{{ end }} +<div class="mt-10 flex justify-center"> + <a href="{{ $showMoreLinkDest }}"> + <button + class="bg-transparent hover:text-primary-500 prose dark:prose-invert font-semibold hover:text-white py-2 px-4 border border-primary-500 hover:border-transparent rounded"> + {{ i18n "recent.show_more" | markdownify | emojify }} + </button> + </a> +</div> +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/related.html b/themes/blowfish/layouts/partials/related.html new file mode 100644 index 0000000..f24f86c --- /dev/null +++ b/themes/blowfish/layouts/partials/related.html @@ -0,0 +1,11 @@ +{{ if .Params.showRelatedContent | default (.Site.Params.article.showRelatedContent | default false)}} +{{ $related := .Site.RegularPages.Related . | first .Site.Params.article.relatedContentLimit }} +{{ with $related }} +<h2 class="mt-8 text-2xl font-extrabold mb-10">{{ i18n "article.related_articles" | emojify }}</h2> +<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3"> + {{ range . }} + {{ partial "article-link/card-related.html" . }} + {{ end }} +</section> +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/schema.html b/themes/blowfish/layouts/partials/schema.html new file mode 100644 index 0000000..77ecfa3 --- /dev/null +++ b/themes/blowfish/layouts/partials/schema.html @@ -0,0 +1,49 @@ +{{ if .IsHome -}} + <script type="application/ld+json"> + { + "@context": "https://schema.org", + "@type": "WebSite", + "@id": "{{ (site.GetPage "/").Permalink | safeURL }}", + "name": "{{ .Site.Title | safeJS }}", + {{ with .Site.Params.description }}"description": "{{ . | safeJS }}",{{ end }} + {{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }} + "url": "{{ (site.GetPage "/").Permalink | safeURL }}", + {{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }} + "publisher" : { + "@type": "Person", + "name": "{{ .Site.Author.name | safeJS }}" + } + } + </script> +{{ else if .IsPage }} + {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + <script type="application/ld+json"> + [{ + "@context": "https://schema.org", + "@type": "Article", + "articleSection": "{{ (site.GetPage .Section).Title | safeJS }}", + "name": "{{ .Title | safeJS }}", + "headline": "{{ .Title | safeJS }}", + {{ with .Description }}"description": "{{ . | safeJS }}",{{ end }} + {{ with .Summary }}"abstract": "{{ . | safeJS }}",{{ end }} + {{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }} + "url" : "{{ .Permalink }}", + "author" : { + "@type": "Person", + "name": "{{ .Site.Author.name | safeJS }}" + }, + {{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }} + {{ with .Date }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }} + {{ with .PublishDate }}"datePublished": "{{ .Format $iso8601 }}",{{ end }} + {{ with .ExpiryDate }}"expires": "{{ .Format $iso8601 }}",{{ end }} + {{ with .Lastmod }}"dateModified": "{{ .Format $iso8601 }}",{{ end }} + {{ if .Keywords }} + {{ with .Keywords }}"keywords": {{ . }},{{ end }} + {{ else }} + {{ with .Params.tags }}"keywords": {{ . }},{{ end }} + {{ end }} + "mainEntityOfPage": "true", + "wordCount": "{{ .WordCount }}" + }] + </script> +{{ end }} diff --git a/themes/blowfish/layouts/partials/scroll-to-top.html b/themes/blowfish/layouts/partials/scroll-to-top.html new file mode 100644 index 0000000..f84cbb5 --- /dev/null +++ b/themes/blowfish/layouts/partials/scroll-to-top.html @@ -0,0 +1,7 @@ +<div id="top-scroller" class="pointer-events-none absolute top-[110vh] bottom-0 w-12 ltr:right-0 rtl:left-0"> + <a href="#the-top" + class="pointer-events-auto sticky top-[calc(100vh-5.5rem)] flex h-12 w-12 mb-16 items-center justify-center rounded-full bg-neutral/50 text-xl text-neutral-700 hover:text-primary-600 dark:bg-neutral-800/50 dark:text-neutral dark:hover:text-primary-400" + aria-label="{{ i18n "nav.scroll_to_top_title" }}" title="{{ i18n "nav.scroll_to_top_title" }}"> + ↑ + </a> +</div>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/search.html b/themes/blowfish/layouts/partials/search.html new file mode 100644 index 0000000..78ae523 --- /dev/null +++ b/themes/blowfish/layouts/partials/search.html @@ -0,0 +1,48 @@ +<div + id="search-wrapper" + class="invisible fixed inset-0 flex h-screen w-screen cursor-default flex-col bg-neutral-500/50 p-4 backdrop-blur-sm dark:bg-neutral-900/50 sm:p-6 md:p-[10vh] lg:p-[12vh]" + data-url="{{ "" | absLangURL }}" + style="z-index:500" +> + <div + id="search-modal" + class="flex flex-col w-full max-w-3xl min-h-0 mx-auto border rounded-md shadow-lg top-20 border-neutral-200 bg-neutral dark:border-neutral-700 dark:bg-neutral-800" + > + <header class="relative z-10 flex items-center justify-between flex-none px-2"> + <form class="flex items-center flex-auto min-w-0"> + <div class="flex items-center justify-center w-8 h-8 text-neutral-400"> + {{ partial "icon.html" "search" }} + </div> + <input + type="search" + id="search-query" + class="flex flex-auto h-12 mx-1 bg-transparent appearance-none focus:outline-dotted focus:outline-2 focus:outline-transparent" + placeholder="{{ i18n "search.input_placeholder" }}" + tabindex="0" + /> + </form> + <button + id="close-search-button" + class="flex items-center justify-center w-8 h-8 text-neutral-700 hover:text-primary-600 dark:text-neutral dark:hover:text-primary-400" + title="{{ i18n "search.close_button_title" }}" + > + {{ partial "icon.html" "xmark" }} + </button> + </header> + <section class="flex-auto px-2 overflow-auto"> + <ul id="search-results"> + <!-- <li class="mb-2"> + <a class="flex items-center px-3 py-2 rounded-md appearance-none bg-neutral-100 dark:bg-neutral-700 focus:bg-primary-100 hover:bg-primary-100 dark:hover:bg-primary-900 dark:focus:bg-primary-900 focus:outline-dotted focus:outline-transparent focus:outline-2" href="${value.item.permalink}" tabindex="0"> + <div class="grow"> + <div class="-mb-1 text-lg font-bold">${value.item.title}</div> + <div class="text-sm text-neutral-500 dark:text-neutral-400">${value.item.section}<span class="px-2 text-primary-500">·</span>${value.item.date}</span></div> + <div class="text-sm italic">${value.item.summary}</div> + </div> + <div class="ml-2 ltr:block rtl:hidden text-neutral-500">→</div> + <div class="mr-2 ltr:hidden rtl:block text-neutral-500">←</div> + </a> + </li> --> + </ul> + </section> + </div> +</div> diff --git a/themes/blowfish/layouts/partials/series/series-closed.html b/themes/blowfish/layouts/partials/series/series-closed.html new file mode 100644 index 0000000..ecab0cc --- /dev/null +++ b/themes/blowfish/layouts/partials/series/series-closed.html @@ -0,0 +1,5 @@ +{{ if .Params.series }} +<details style="margin-left:0px" class="mt-2 mb-5 overflow-hidden rounded-lg ltr:-ml-5 ltr:pl-5 rtl:-mr-5 rtl:pr-5"> + {{ partial "series/series_base.html" . }} +</details> +{{end}}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/series/series.html b/themes/blowfish/layouts/partials/series/series.html new file mode 100644 index 0000000..8d7f704 --- /dev/null +++ b/themes/blowfish/layouts/partials/series/series.html @@ -0,0 +1,6 @@ +{{ if .Params.series }} +<details style="margin-left:0px" class="mt-2 mb-5 overflow-hidden rounded-lg ltr:-ml-5 ltr:pl-5 rtl:-mr-5 rtl:pr-5" {{ + if .Params.seriesOpened | default (.Site.Params.article.seriesOpened | default false) }} open {{ end }}> + {{ partial "series/series_base.html" . }} +</details> +{{end}} diff --git a/themes/blowfish/layouts/partials/series/series_base.html b/themes/blowfish/layouts/partials/series/series_base.html new file mode 100644 index 0000000..91a3d8c --- /dev/null +++ b/themes/blowfish/layouts/partials/series/series_base.html @@ -0,0 +1,22 @@ +{{ if .Params.series }} + <summary + class="py-1 text-lg font-semibold cursor-pointer bg-primary-200 text-neutral-800 ltr:-ml-5 ltr:pl-5 rtl:-mr-5 rtl:pr-5 dark:bg-primary-800 dark:text-neutral-100"> + {{ index .Params.series 0 }} - {{ i18n "article.part_of_series" }} + </summary> + {{ $seriesName := strings.ToLower (index .Params.series 0) }} + {{ range $post := sort (index .Site.Taxonomies.series $seriesName) "Params.series_order" }} + {{ if eq $post.Permalink $.Page.Permalink }} + <div + class="py-1 border-dotted border-neutral-300 ltr:-ml-5 ltr:border-l ltr:pl-5 rtl:-mr-5 rtl:border-r rtl:pr-5 dark:border-neutral-600"> + {{ i18n "article.part" }} {{ $post.Params.series_order }}: {{ i18n "article.this_article" }} + </div> + {{ else }} + <div + class="py-1 border-dotted border-neutral-300 ltr:-ml-5 ltr:border-l ltr:pl-5 rtl:-mr-5 rtl:border-r rtl:pr-5 dark:border-neutral-600"> + <a href="{{$post.Permalink}}"> + {{ i18n "article.part" }} {{ $post.Params.series_order }}: {{ $post.Params.title}} + </a> + </div> + {{end}} + {{end}} +{{end}} diff --git a/themes/blowfish/layouts/partials/sharing-links.html b/themes/blowfish/layouts/partials/sharing-links.html new file mode 100644 index 0000000..67b2923 --- /dev/null +++ b/themes/blowfish/layouts/partials/sharing-links.html @@ -0,0 +1,18 @@ +{{ with .Params.sharingLinks | default (.Site.Params.article.sharingLinks | default false) }} + {{ $links := site.Data.sharing }} + <section class="flex flex-row flex-wrap justify-center pt-4 text-xl"> + {{ range . }} + {{ with index $links . }} + <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="{{ printf .url $.Permalink $.Title }}" + title="{{ i18n .title }}" + aria-label="{{ i18n .title }}" + > + {{ partial "icon.html" .icon }} + </a> + {{ end }} + {{ end }} + </section> +{{ end }} diff --git a/themes/blowfish/layouts/partials/term-link/card.html b/themes/blowfish/layouts/partials/term-link/card.html new file mode 100644 index 0000000..7f2e8ad --- /dev/null +++ b/themes/blowfish/layouts/partials/term-link/card.html @@ -0,0 +1,54 @@ +<a href="{{ .Page.RelPermalink }}" class="min-w-full"> + <div + class="border border-neutral-200 dark:border-neutral-700 border-2 rounded overflow-hidden shadow-2xl relative"> + + {{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} + + {{- with site.Params.images -}} + {{- range first 6 . }} + <meta property="og:image" content="{{ . | absURL }}" />{{ end -}} + {{- else -}} + {{- $images := .Page.Resources.ByType "image" -}} + {{- $featured := $images.GetMatch "*feature*" -}} + {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} + {{- with $featured -}} + {{ if $disableImageOptimization }} + {{ with . }} + <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ else }} + {{ with .Resize "600x" }} + <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ end }} + {{- else -}} + {{- with site.Params.images }} + <meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}} + {{- end -}} + {{- end -}} + + + {{ if site.Params.taxonomy.showTermCount | default true }} + <span class="absolute bottom-0 right-0 m-2"> + <span class="flex"> + <span + class="rounded-md border border-primary-400 px-1 py-[1px] text-xl font-normal text-primary-700 dark:border-primary-600 dark:text-primary-400" + > + {{ .Count }} + </span> + </span> + </span> + {{ end }} + + <div class="px-6 py-4"> + + <div + class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral" + >{{ .Page.Title | emojify }}</div> + + </div> + <div class="px-6 pt-4 pb-2"> + + </div> + </div> +</a>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/term-link/text.html b/themes/blowfish/layouts/partials/term-link/text.html new file mode 100644 index 0000000..c467cef --- /dev/null +++ b/themes/blowfish/layouts/partials/term-link/text.html @@ -0,0 +1,15 @@ +<article class="w-full px-2 my-3 overflow-hidden sm:w-1/2 md:w-1/3 lg:w-1/4 xl:w-1/4"> + <h2 class="flex items-center"> + <a + class="text-xl font-medium decoration-primary-500 hover:underline hover:underline-offset-2" + href="{{ .Page.RelPermalink }}" + >{{ .Page.Title }}</a + > + {{ if site.Params.taxonomy.showTermCount | default true }} + <span class="px-2 text-base text-primary-500">·</span> + <span class="text-base text-neutral-400"> + {{ .Count }} + </span> + {{ end }} + </h2> + </article>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/toc.html b/themes/blowfish/layouts/partials/toc.html new file mode 100644 index 0000000..e9dc950 --- /dev/null +++ b/themes/blowfish/layouts/partials/toc.html @@ -0,0 +1,65 @@ +<details open class="toc-right mt-0 overflow-hidden rounded-lg ltr:-ml-5 ltr:pl-5 rtl:-mr-5 rtl:pr-5 hidden lg:block"> + <summary + class="block py-1 text-lg font-semibold cursor-pointer bg-neutral-100 text-neutral-800 ltr:-ml-5 ltr:pl-5 rtl:-mr-5 rtl:pr-5 dark:bg-neutral-700 dark:text-neutral-100 lg:hidden"> + {{ i18n "article.table_of_contents" }} + </summary> + <div + class="min-w-[220px] py-2 border-dotted border-neutral-300 ltr:-ml-5 ltr:border-l ltr:pl-5 rtl:-mr-5 rtl:border-r rtl:pr-5 dark:border-neutral-600"> + {{ .TableOfContents | emojify }} + </div> +</details> +<details class="toc-inside mt-0 overflow-hidden rounded-lg ltr:-ml-5 ltr:pl-5 rtl:-mr-5 rtl:pr-5 lg:hidden"> + <summary + class="py-1 text-lg font-semibold cursor-pointer bg-neutral-100 text-neutral-800 ltr:-ml-5 ltr:pl-5 rtl:-mr-5 rtl:pr-5 dark:bg-neutral-700 dark:text-neutral-100 lg:hidden"> + {{ i18n "article.table_of_contents" }} + </summary> + <div + class="py-2 border-dotted border-neutral-300 ltr:-ml-5 ltr:border-l ltr:pl-5 rtl:-mr-5 rtl:border-r rtl:pr-5 dark:border-neutral-600"> + {{ .TableOfContents | emojify }} + </div> +</details> + +{{ if .Site.Params.smartTOC }} +<script> + (function () { + var $toc = $('#TableOfContents'); + if ($toc.length > 0) { + var $window = $(window); + + function onScroll() { + var currentScroll = $window.scrollTop(); + var h = $('.anchor'); + var id = ""; + h.each(function (i, e) { + e = $(e); + if (e.offset().top - $(window).height()/3 <= currentScroll) { + id = e.attr('id'); + } + }); + var active = $toc.find('a.active'); + if (active.length == 1 && active.eq(0).attr('href') == '#' + id) return true; + + active.each(function (i, e) { + {{ if .Site.Params.smartTOCHideUnfocusedChildren }} + $(e).removeClass('active').siblings('ul').hide(); + {{ else }} + $(e).removeClass('active'); + {{ end }} + }); + $toc.find('a[href="#' + id + '"]').addClass('active') + $toc.find('a[href="#' + id + '"]').parentsUntil('#TableOfContents').each(function (i, e) { + $(e).children('a').parents('ul').show(); + }); + } + + $window.on('scroll', onScroll); + $(document).ready(function () { + {{ if .Site.Params.smartTOCHideUnfocusedChildren }} + $toc.find('a').parent('li').find('ul').hide(); + {{ end }} + onScroll(); + }); + } + })(); +</script> +{{ end }}
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/translations.html b/themes/blowfish/layouts/partials/translations.html new file mode 100644 index 0000000..e09ffb3 --- /dev/null +++ b/themes/blowfish/layouts/partials/translations.html @@ -0,0 +1,25 @@ +{{ if .IsTranslated }} +<div> + <div class="cursor-pointer flex items-center nested-menu"> + <span class="mr-1"> + {{ partial "icon.html" "language" }} + </span> + <div class="text-sm font-medium text-gray-500 hover:text-primary-600 dark:hover:text-primary-400" title="{{ .Title }}"> + {{- i18n "global.language" | markdownify | emojify -}} + </div> + </div> + <div class="absolute menuhide"> + <div class="pt-2 p-5 mt-2 rounded-xl backdrop-blur shadow-2xl"> + <div class="flex flex-col space-y-3"> + {{ range .AllTranslations }} + <a href="{{ .RelPermalink }}" class="flex items-center"> + <p class="text-sm font-sm text-gray-500 hover:text-primary-600 dark:hover:text-primary-400" title="{{ .Title }}"> + {{ .Language.Params.displayName | emojify }} + </p> + </a> + {{ end }} + </div> + </div> + </div> +</div> +{{ end }} diff --git a/themes/blowfish/layouts/partials/vendor.html b/themes/blowfish/layouts/partials/vendor.html new file mode 100644 index 0000000..d1e77f8 --- /dev/null +++ b/themes/blowfish/layouts/partials/vendor.html @@ -0,0 +1,75 @@ +{{/* jQuery */}} +{{ $jqueryLib := resources.Get "lib/jquery/jquery.slim.min.js" }} +<script src="{{ $jqueryLib.RelPermalink }}" integrity="{{ $jqueryLib.Data.Integrity }}"></script> + +{{/* Mermaid */}} +{{ if .Page.HasShortcode "mermaid" }} + {{ $mermaidLib := resources.Get "lib/mermaid/mermaid.min.js" }} + {{ $mermaidConfig := resources.Get "js/mermaid.js" }} + {{ $mermaidConfig := $mermaidConfig | resources.Minify }} + {{ $mermaidJS := slice $mermaidLib $mermaidConfig | resources.Concat "js/mermaid.bundle.js" | resources.Fingerprint "sha512" }} + <script + defer + type="text/javascript" + src="{{ $mermaidJS.RelPermalink }}" + integrity="{{ $mermaidJS.Data.Integrity }}" + ></script> +{{ end }} + +{{/* Chart */}} +{{ if .Page.HasShortcode "chart" }} +{{ $chartLib := resources.Get "lib/chart/chart.min.js" }} +{{ $chartConfig := resources.Get "js/chart.js" }} +{{ $chartConfig := $chartConfig | resources.Minify }} +{{ $chartJS := slice $chartLib $chartConfig | resources.Concat "js/chart.bundle.js" | resources.Fingerprint "sha512" }} +<script defer type="text/javascript" src="{{ $chartJS.RelPermalink }}" + integrity="{{ $chartJS.Data.Integrity }}"></script> +{{ end }} + +{{/* Katex */}} +{{ if .Page.HasShortcode "katex" }} +{{ $katexCSS := resources.Get "lib/katex/katex.min.css" }} +{{ $katexCSS := $katexCSS | resources.Fingerprint "sha512" }} +<link type="text/css" rel="stylesheet" href="{{ $katexCSS.RelPermalink }}" integrity="{{ $katexCSS.Data.Integrity }}" /> +{{ $katexJS := resources.Get "lib/katex/katex.min.js" }} +{{ $katexJS := $katexJS | resources.Fingerprint "sha512" }} +<script defer src="{{ $katexJS.RelPermalink }}" integrity="{{ $katexJS.Data.Integrity }}"></script> +{{ $katexRenderJS := resources.Get "lib/katex/auto-render.min.js" }} +{{ $katexRenderJS := $katexRenderJS | resources.Fingerprint "sha512" }} +<script defer src="{{ $katexRenderJS.RelPermalink }}" integrity="{{ $katexRenderJS.Data.Integrity }}" + onload="renderMathInElement(document.body);"></script> +{{ $katexFonts := resources.Match "lib/katex/fonts/*" }} +{{ range $katexFonts }} +<!-- {{ .RelPermalink }} --> +{{ end }} +{{ end }} + +{{/* TypeIt */}} +{{ if .Page.HasShortcode "typeit" }} +{{ $typeitLib := resources.Get "lib/typeit/typeit.umd.js" }} +<script defer src="{{ $typeitLib.RelPermalink }}" integrity="{{ $typeitLib.Data.Integrity }}"></script> +{{ end }} + +{{/* Packery */}} +{{ if .Page.HasShortcode "gallery" }} + {{ $packeryLib := resources.Get "lib/packery/packery.pkgd.min.js" }} + <script defer src="{{ $packeryLib.RelPermalink }}" integrity="{{ $packeryLib.Data.Integrity }}"></script> + + {{ $jsShortcodeGallery := resources.Get "js/shortcodes/gallery.js" }} + {{ $jsShortcodeGallery = $jsShortcodeGallery | resources.Minify | resources.Fingerprint "sha512" }} + <script type="text/javascript" src="{{ $jsShortcodeGallery.RelPermalink }}" integrity="{{ $jsShortcodeGallery.Data.Integrity }}"></script> +{{ end }} + +{{/* tw-elements */}} +{{ if or (.Page.HasShortcode "carousel") (.Page.HasShortcode "timeline")}} +{{ $twelementsLib := resources.Get "lib/tw-elements/index.min.js" }} +<script defer src="{{ $twelementsLib.RelPermalink }}" integrity="{{ $twelementsLib.Data.Integrity }}"></script> +{{ end }} + +{{/* youtubeLite */}} +{{ if .Page.HasShortcode "youtubeLite" }} +{{ $youtubeLiteJS := resources.Get "lib/lite-youtube-embed/lite-yt-embed.js" }} +{{ $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 |