mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
Merge branch 'dev' into feat/image-position
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
{{ with site.Params.fathomAnalytics.site }}
|
||||
{{ partial "analytics/fathom.html" }}
|
||||
{{ if site.Params.fathomAnalytics.site }}
|
||||
{{ partial "analytics/fathom.html" . }}
|
||||
{{ end }}
|
||||
{{ with site.Config.Services.GoogleAnalytics.ID }}
|
||||
{{ partial "analytics/ga.html" }}
|
||||
{{ if site.Config.Services.GoogleAnalytics.ID }}
|
||||
{{ partial "analytics/ga.html" . }}
|
||||
{{ end }}
|
||||
{{ with site.Params.umamiAnalytics.websiteid }}
|
||||
{{ partial "analytics/umami.html" }}
|
||||
{{ if site.Params.umamiAnalytics.websiteid }}
|
||||
{{ partial "analytics/umami.html" . }}
|
||||
{{ end }}
|
||||
{{ with site.Params.selineAnalytics.token }}
|
||||
{{ partial "analytics/seline.html" }}
|
||||
{{ if site.Params.selineAnalytics.token }}
|
||||
{{ partial "analytics/seline.html" . }}
|
||||
{{ end }}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
{{ if site.Params.list.showCards }}
|
||||
{{ $cardClasses = printf "%s overflow-hidden rounded-md border-2 border-neutral-200 dark:border-neutral-700" $cardClasses }}
|
||||
{{ $imgWrapperClasses = "" }}
|
||||
{{ $cardContentClasses = printf "%s p-2.5 pl-4 pb-0" $cardContentClasses }}
|
||||
{{ $figureClasses = "" }}
|
||||
{{ $cardContentClasses = printf "%s p-4 pt-2" $cardContentClasses }}
|
||||
{{ else }}
|
||||
{{ $cardClasses = printf "%s" $cardClasses }}
|
||||
{{ $imgWrapperClasses = printf "%s thumbnail-shadow md:mr-7" $imgWrapperClasses }}
|
||||
@@ -85,7 +85,7 @@
|
||||
<div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
alt=""
|
||||
alt="{{ with $target.Params.featuredImageAlt }}{{ . }}{{ else }}{{ $target.Title | emojify }}{{ end }}"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
class="not-prose absolute inset-0 w-full h-full object-cover">
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<div class="flex-none relative overflow-hidden thumbnail_card_related">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
alt=""
|
||||
alt="{{ $page.Title }}"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
fetchpriority="low"
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<div class="flex-none relative overflow-hidden thumbnail_card">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
alt=""
|
||||
alt="{{ $page.Title | plainify }}"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
class="not-prose absolute inset-0 w-full h-full object-cover">
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
<div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
alt=""
|
||||
alt="{{ $.Params.featuredImageAlt | default ($.Title | emojify) }}"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
class="not-prose absolute inset-0 w-full h-full object-cover">
|
||||
|
||||
@@ -9,52 +9,36 @@
|
||||
<div class="pt-8">
|
||||
<hr class="border-dotted border-neutral-300 dark:border-neutral-600">
|
||||
<div class="flex justify-between pt-3">
|
||||
<span>
|
||||
<span class="flex flex-col">
|
||||
{{ 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>
|
||||
<a
|
||||
class="flex text-neutral-700 hover:text-primary-600 dark:text-neutral dark:hover:text-primary-400"
|
||||
href="{{ $prev.RelPermalink }}">
|
||||
<span class="leading-6">
|
||||
<span class="inline-block rtl:rotate-180">←</span> {{ $prev.Title | emojify }}
|
||||
</span>
|
||||
</a>
|
||||
{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
|
||||
<span class="ms-6 mt-1 text-xs text-neutral-500 dark:text-neutral-400">
|
||||
{{ partial "meta/date.html" $prev.Date }}
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</span>
|
||||
<span>
|
||||
<span class="flex flex-col items-end">
|
||||
{{ 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>
|
||||
<a
|
||||
class="flex text-right text-neutral-700 hover:text-primary-600 dark:text-neutral dark:hover:text-primary-400"
|
||||
href="{{ $next.RelPermalink }}">
|
||||
<span class="leading-6">
|
||||
{{ $next.Title | emojify }} <span class="inline-block rtl:rotate-180">→</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>
|
||||
{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
|
||||
<span class="me-6 mt-1 text-xs text-neutral-500 dark:text-neutral-400">
|
||||
{{ partial "meta/date.html" $next.Date }}
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -8,14 +8,16 @@
|
||||
{{ $authorImage = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ if $authorImage }}
|
||||
{{ $final := $authorImage }}
|
||||
{{ if not $disableImageOptimization }}
|
||||
{{ $authorImage = $authorImage.Fill "192x192" }}
|
||||
{{ $final = $authorImage.Fill "192x192" }}
|
||||
{{ end }}
|
||||
<img
|
||||
class="!mt-0 !mb-0 h-24 w-24 rounded-full me-4"
|
||||
width="96"
|
||||
height="96"
|
||||
src="{{ $authorImage.RelPermalink }}">
|
||||
src="{{ $final.RelPermalink }}"
|
||||
data-zoom-src="{{ $authorImage.RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<div class="place-self-center">
|
||||
|
||||
@@ -8,26 +8,30 @@
|
||||
{{ $authorImage = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ if $authorImage }}
|
||||
{{ $final := $authorImage }}
|
||||
{{ if not $disableImageOptimization }}
|
||||
{{ $authorImage = $authorImage.Fill "192x192" }}
|
||||
{{ $final = $authorImage.Fill "192x192" }}
|
||||
{{ end }}
|
||||
<img
|
||||
class="!mt-0 !mb-0 h-24 w-24 rounded-full me-4"
|
||||
width="96"
|
||||
height="96"
|
||||
alt="{{ $.Site.Params.Author.name | default " Author" }}"
|
||||
src="{{ $authorImage.RelPermalink }}">
|
||||
src="{{ $final.RelPermalink }}"
|
||||
data-zoom-src="{{ $authorImage.RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ $authorImage := resources.GetRemote . }}
|
||||
{{ $final := $authorImage }}
|
||||
{{ if not $disableImageOptimization }}
|
||||
{{ $authorImage = $authorImage.Fill "192x192" }}
|
||||
{{ $final = $authorImage.Fill "192x192" }}
|
||||
{{ end }}
|
||||
<img
|
||||
class="!mt-0 !mb-0 h-24 w-24 rounded-full me-4"
|
||||
width="96"
|
||||
height="96"
|
||||
alt="{{ $.Site.Params.Author.name | default " Author" }}"
|
||||
src="{{ $authorImage.RelPermalink }}">
|
||||
src="{{ $authorImage.RelPermalink }}"
|
||||
data-zoom-src="{{ $authorImage.RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<div class="place-self-center">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
{{ end }}
|
||||
{{ $navClass := printf "flex flex-row pb-4 text-base font-medium text-neutral-500 dark:text-neutral-400 %s" (cond $onlyIcon "overflow-x-auto py-2" "") }}
|
||||
{{ $ulClass := printf "flex list-none %s" (cond $onlyIcon "flex-row" "flex-col sm:flex-row") }}
|
||||
{{ $liClass := printf "flex mb-1 text-end sm:mb-0 sm:me-7 sm:last:me-0 %s" (cond $onlyIcon "ltr:mr-4 rtl:ml-4" "") }}
|
||||
{{ $liClass := printf "flex mb-1 text-end sm:mb-0 sm:me-7 sm:last:me-0 %s" (cond $onlyIcon "me-4" "") }}
|
||||
<nav class="{{ $navClass }}">
|
||||
<ul class="{{ $ulClass }}">
|
||||
{{ range .Site.Menus.footer }}
|
||||
|
||||
+144
-154
@@ -8,21 +8,21 @@
|
||||
<meta name="theme-color">
|
||||
|
||||
{{/* Title */}}
|
||||
{{ if .IsHome -}}
|
||||
{{ if .IsHome }}
|
||||
<title>{{ .Site.Title | emojify }}</title>
|
||||
<meta name="title" content="{{ .Site.Title | emojify }}">
|
||||
{{- else -}}
|
||||
{{ else }}
|
||||
<title>{{ .Title | emojify }} · {{ .Site.Title | emojify }}</title>
|
||||
<meta name="title" content="{{ .Title | emojify }} · {{ .Site.Title | emojify }}">
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Metadata */}}
|
||||
{{ with (.Params.Summary | default .Params.Description) | default .Site.Params.description -}}
|
||||
{{ 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 }}
|
||||
{{ end }}
|
||||
{{ with .Params.Tags | default .Site.Params.keywords }}
|
||||
<meta name="keywords" content="{{ range . }}{{ . }},{{ end }}">
|
||||
{{ end }}
|
||||
{{ with .Site.Params.robots }}
|
||||
<meta name="robots" content="{{ . }}">
|
||||
{{ end }}
|
||||
@@ -30,112 +30,51 @@
|
||||
<meta name="robots" content="{{ . }}">
|
||||
{{ end }}
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
{{ 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 }}
|
||||
{{ if not .Site.Params.disableImageZoom | default true }}
|
||||
{{ $cssZoom := resources.Get "lib/zoom/style.css" }}
|
||||
{{ $assets.Add "css" (slice $cssZoom) }}
|
||||
{{ end }}
|
||||
{{ $bundleCSS := $assets.Get "css" | resources.Concat "css/main.bundle.css" | resources.Minify | resources.Fingerprint
|
||||
(.Site.Params.fingerprintAlgorithm | default "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 (.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ $jsAppearance.RelPermalink }}"
|
||||
integrity="{{ $jsAppearance.Data.Integrity }}"></script>
|
||||
{{ if site.Params.footer.showScrollToTop | default true }}
|
||||
{{ $jsToTop := resources.Get "js/scroll-to-top.js" }}
|
||||
{{ $assets.Add "js" (slice $jsToTop) }}
|
||||
{{ end }}
|
||||
{{ if .Site.Params.enableA11y | default false }}
|
||||
{{ $jsA11y := resources.Get "js/a11y.js" }}
|
||||
{{ $jsA11y = $jsA11y | resources.Minify | resources.Fingerprint (site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
<script src="{{ $jsA11y.RelPermalink }}" integrity="{{ $jsA11y.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ $shouldIncludeZenMode := or (.Site.Params.enableA11y | default false) (.Params.showZenMode | default (.Site.Params.article.showZenMode | default false)) }}
|
||||
{{ if and .IsPage $shouldIncludeZenMode }}
|
||||
{{ $jsZenMode := resources.Get "js/zen-mode.js" }}
|
||||
{{ $jsZenMode = $jsZenMode | resources.Minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ $jsZenMode.RelPermalink }}"
|
||||
integrity="{{ $jsZenMode.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ if site.Params.footer.showScrollToTop | default true }}
|
||||
{{ $jsToTop := resources.Get "js/scroll-to-top.js" }}
|
||||
{{ $assets.Add "js" (slice $jsToTop) }}
|
||||
{{ end }}
|
||||
{{ 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 }}
|
||||
{{ $jsMobileMenu := resources.Get "js/mobilemenu.js" }}
|
||||
{{ $assets.Add "js" (slice $jsMobileMenu) }}
|
||||
{{ $buttonLikes := resources.Get "js/button-likes.js" }}
|
||||
{{ $assets.Add "js" (slice $buttonLikes) }}
|
||||
{{ $katexRender := resources.Get "js/katex-render.js" }}
|
||||
{{ $assets.Add "js" (slice $katexRender) }}
|
||||
{{ if $assets.Get "js" }}
|
||||
{{ $bundleJS := $assets.Get "js" | resources.Concat "js/main.bundle.js" | resources.Minify | resources.Fingerprint
|
||||
(.Site.Params.fingerprintAlgorithm | default "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 }}
|
||||
{{ $zoomJS := resources.Get "lib/zoom/zoom.min.umd.js" | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
<script src="{{ $zoomJS.RelPermalink }}" integrity="{{ $zoomJS.Data.Integrity }}"></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 }}">
|
||||
{{/* Me */}}
|
||||
{{ with .Site.Params.Author.name }}
|
||||
<meta name="author" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ with .Site.Params.Author.links }}
|
||||
{{ range $links := . }}
|
||||
{{ range $name, $url := $links }}
|
||||
{{ if not (strings.HasPrefix $url "mailto:") }}
|
||||
<link href="{{ $url }}" rel="me">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Social */}}
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
{{/* Use defaultSocialImage if feature image does not exist */}}
|
||||
{{ $featureImage := "" }}
|
||||
{{ $pageImages := .Resources.ByType "image" }}
|
||||
{{ range slice "*featured*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featureImage }}
|
||||
{{ $featureImage = $pageImages.GetMatch . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if not $featureImage }}
|
||||
{{ with .Site.Params.defaultSocialImage }}
|
||||
{{ $socialImage := "" }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ $socialImage = resources.GetRemote . }}
|
||||
{{ else }}
|
||||
{{ $socialImage = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ with $socialImage }}
|
||||
<meta name="twitter:image" content="{{ .RelPermalink | absURL }}">
|
||||
<meta property="og:image" content="{{ .RelPermalink | absURL }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Site Verification */}}
|
||||
@@ -155,52 +94,101 @@
|
||||
<meta name="fediverse:creator" content="{{ . }}">
|
||||
{{ end }}
|
||||
|
||||
{{/* Social */}}
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
{{ $alg := .Site.Params.fingerprintAlgorithm | default "sha512" }}
|
||||
|
||||
{{- /* Main page always uses this; fallback elsewhere if no feature image */ -}}
|
||||
{{- /* See https://gohugo.io/templates/embedded/#open-graph */ -}}
|
||||
{{- $images := .Resources.ByType "image" -}}
|
||||
{{- $socialImage := $images.GetMatch "*feature*" -}}
|
||||
{{/* CSS */}}
|
||||
{{ $cssResources := slice }}
|
||||
{{ $schemeName := .Site.Params.colorScheme | default "blowfish" }}
|
||||
{{ $cssScheme := resources.Get (printf "css/schemes/%s.css" $schemeName) | default (resources.Get "css/schemes/blowfish.css") }}
|
||||
{{ $cssResources = $cssResources | append $cssScheme }}
|
||||
{{ $cssResources = $cssResources | append (resources.Get "css/compiled/main.css") }}
|
||||
{{ with resources.Get "css/custom.css" }}
|
||||
{{ $cssResources = $cssResources | append . }}
|
||||
{{ end }}
|
||||
{{ if not .Site.Params.disableImageZoom | default true }}
|
||||
{{ $cssResources = $cssResources | append (resources.Get "lib/zoom/style.css") }}
|
||||
{{ end }}
|
||||
{{ $bundleCSS := $cssResources | resources.Concat "css/main.bundle.css" | resources.Minify | resources.Fingerprint $alg }}
|
||||
<link
|
||||
type="text/css"
|
||||
rel="stylesheet"
|
||||
href="{{ $bundleCSS.RelPermalink }}"
|
||||
integrity="{{ $bundleCSS.Data.Integrity }}">
|
||||
|
||||
{{- if not $socialImage -}}
|
||||
{{- with .Site.Params.defaultSocialImage -}}
|
||||
{{- if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") -}}
|
||||
{{- $socialImage = resources.GetRemote . -}}
|
||||
{{- else -}}
|
||||
{{- $socialImage = resources.Get . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{/* JS loaded immediately */}}
|
||||
{{ $jsAppearance := resources.Get "js/appearance.js" | resources.ExecuteAsTemplate "js/appearance.js" . | resources.Minify | resources.Fingerprint $alg }}
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ $jsAppearance.RelPermalink }}"
|
||||
integrity="{{ $jsAppearance.Data.Integrity }}"></script>
|
||||
{{ $enableA11y := .Site.Params.enableA11y | default false }}
|
||||
{{ if $enableA11y }}
|
||||
{{ $jsA11y := resources.Get "js/a11y.js" | resources.Minify | resources.Fingerprint $alg }}
|
||||
<script src="{{ $jsA11y.RelPermalink }}" integrity="{{ $jsA11y.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ $showZenMode := .Params.showZenMode | default (.Site.Params.article.showZenMode | default false) }}
|
||||
{{ $shouldIncludeZenMode := or $enableA11y $showZenMode }}
|
||||
{{ if and .IsPage $shouldIncludeZenMode }}
|
||||
{{ $jsZenMode := resources.Get "js/zen-mode.js" | resources.Minify | resources.Fingerprint $alg }}
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ $jsZenMode.RelPermalink }}"
|
||||
integrity="{{ $jsZenMode.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ if not .Site.Params.disableImageZoom | default true }}
|
||||
{{ $zoomJS := resources.Get "lib/zoom/zoom.min.umd.js" | resources.Fingerprint $alg }}
|
||||
<script src="{{ $zoomJS.RelPermalink }}" integrity="{{ $zoomJS.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{- with $socialImage -}}
|
||||
<meta name="twitter:image" content="{{ .RelPermalink | absURL }}">
|
||||
<meta property="og:image" content="{{ .RelPermalink | absURL }}">
|
||||
{{- end -}}
|
||||
{{/* JS deferred */}}
|
||||
{{ $jsResources := slice }}
|
||||
{{ if site.Params.footer.showScrollToTop | default true }}
|
||||
{{ $jsResources = $jsResources | append (resources.Get "js/scroll-to-top.js") }}
|
||||
{{ end }}
|
||||
{{ if .Site.Params.enableSearch | default false }}
|
||||
{{ $jsResources = $jsResources | append (resources.Get "lib/fuse/fuse.min.js") | append (resources.Get "js/search.js") }}
|
||||
{{ end }}
|
||||
{{ if .Site.Params.enableCodeCopy | default false }}
|
||||
{{ $jsResources = $jsResources | append (resources.Get "js/code.js") }}
|
||||
{{ end }}
|
||||
{{ if .Site.Params.rtl | default false }}
|
||||
{{ $jsResources = $jsResources | append (resources.Get "js/rtl.js") }}
|
||||
{{ end }}
|
||||
{{ $jsResources = $jsResources | append (resources.Get "js/mobilemenu.js") }}
|
||||
{{ $jsResources = $jsResources | append (resources.Get "js/button-likes.js") }}
|
||||
{{ $jsResources = $jsResources | append (resources.Get "js/katex-render.js") }}
|
||||
{{ if $jsResources }}
|
||||
{{ $bundleJS := $jsResources | resources.Concat "js/main.bundle.js" | resources.Minify | resources.Fingerprint $alg }}
|
||||
<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 }}
|
||||
|
||||
{{/* Conditional loaded resources */}}
|
||||
{{ partial "vendor.html" . }}
|
||||
|
||||
{{/* 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 }}
|
||||
|
||||
{{/* Schema */}}
|
||||
{{ partial "schema.html" . }}
|
||||
|
||||
{{/* Me */}}
|
||||
{{ with .Site.Params.Author.name }}
|
||||
<meta name="author" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ with .Site.Params.Author.links }}
|
||||
{{ range $links := . }}
|
||||
{{ range $name, $url := $links }}
|
||||
{{ if not (strings.HasPrefix $url "mailto:") }}
|
||||
<link href="{{ $url }}" rel="me">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Vendor */}}
|
||||
{{ partial "vendor.html" . }}
|
||||
|
||||
{{/* Analytics */}}
|
||||
{{ partial "analytics/main.html" .Site }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ partial "analytics/main.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Extend head - eg. for custom analytics scripts, etc. */}}
|
||||
{{ if templates.Exists "partials/extend-head.html" }}
|
||||
@@ -218,11 +206,11 @@
|
||||
<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>
|
||||
<script>
|
||||
|
||||
const firebaseConfig = {
|
||||
apiKey: {{ $.Site.Params.firebase.apiKey }},
|
||||
authDomain: {{ $.Site.Params.firebase.apiKey }},
|
||||
authDomain: {{ $.Site.Params.firebase.authDomain }},
|
||||
projectId: {{ $.Site.Params.firebase.projectId }},
|
||||
storageBucket: {{ $.Site.Params.firebase.storageBucket }},
|
||||
messagingSenderId: {{ $.Site.Params.firebase.messagingSenderId }},
|
||||
@@ -230,18 +218,20 @@
|
||||
measurementId: {{ $.Site.Params.firebase.measurementId }}
|
||||
};
|
||||
|
||||
var app = firebase.initializeApp(firebaseConfig);
|
||||
var db = firebase.firestore();
|
||||
var auth = firebase.auth();
|
||||
var app = firebase.initializeApp(firebaseConfig);
|
||||
var db = firebase.firestore();
|
||||
var auth = firebase.auth();
|
||||
|
||||
</script>
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Advertisement */}}
|
||||
{{ with .Site.Params.advertisement.adsense }}
|
||||
<meta name="google-adsense-account" content="{{ . }}">
|
||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client={{ . }}"
|
||||
crossorigin="anonymous"></script>
|
||||
<script
|
||||
async
|
||||
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client={{ . }}"
|
||||
crossorigin="anonymous"></script>
|
||||
{{ end }}
|
||||
</head>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
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 }}">
|
||||
alt="">
|
||||
{{ end }}
|
||||
</a>
|
||||
</div>
|
||||
@@ -68,7 +68,7 @@
|
||||
{{ end }}
|
||||
|
||||
{{/* Mobile navigation */}}
|
||||
{{ define "HeaderMobileNavigation" }}
|
||||
{{ define "HeaderMobileToolbar" }}
|
||||
<div class="flex md:hidden items-center gap-x-5 md:ml-12 h-12">
|
||||
<span></span>
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "HeaderMobileMenu" }}
|
||||
{{ define "HeaderMobileNavigation" }}
|
||||
<div class="-my-2 md:hidden">
|
||||
<div id="menu-button" class="block">
|
||||
{{ if .Site.Menus.main }}
|
||||
@@ -243,7 +243,7 @@
|
||||
|
||||
{{/* ========== Render HTML ========== */}}
|
||||
<div
|
||||
class="main-menu flex items-center justify-between px-4 py-6 sm:px-6 md:justify-start gap-x-3 pt-[2px] pr-0 pb-[3px] pl-0">
|
||||
class="main-menu flex items-center justify-between py-6 md:justify-start gap-x-3 pt-[2px] pr-2 md:pr-4 pb-[3px] pl-0">
|
||||
{{ template "HeaderLogo" . }}
|
||||
<div class="flex flex-1 items-center justify-between">
|
||||
<nav class="flex space-x-3">
|
||||
@@ -254,9 +254,9 @@
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ template "HeaderDesktopNavigation" . }}
|
||||
{{ template "HeaderMobileNavigation" . }}
|
||||
{{ template "HeaderMobileToolbar" . }}
|
||||
</div>
|
||||
{{ template "HeaderMobileMenu" . }}
|
||||
{{ template "HeaderMobileNavigation" . }}
|
||||
</div>
|
||||
|
||||
{{ if .Site.Menus.subnavigation }}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="min-h-[148px]"></div>
|
||||
<div class="fixed inset-x-0 pl-[24px] pr-[24px] z-100">
|
||||
<div class="fixed inset-x-0 z-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">
|
||||
<div class="relative m-auto leading-7 max-w-7xl px-6 sm:px-14 md:px-24 lg:px-32">
|
||||
{{ partial "header/basic.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="min-h-[148px]"></div>
|
||||
<div class="fixed inset-x-0 pl-[24px] pr-[24px] bg-neutral dark:bg-neutral-800 z-100">
|
||||
<div class="relative max-w-[64rem] ml-auto mr-auto">
|
||||
<div class="fixed inset-x-0 bg-neutral dark:bg-neutral-800 z-100">
|
||||
<div class="relative m-auto leading-7 max-w-7xl px-6 sm:px-14 md:px-24 lg:px-32">
|
||||
{{ partial "header/basic.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<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 z-80"></div>
|
||||
<div class="fixed inset-x-0 pl-[24px] pr-[24px] z-100">
|
||||
class="fixed inset-x-0 min-h-[130px] opacity-65 bg-gradient-to-b from-neutral from-60% dark:from-neutral-800 to-transparent mix-blend-normal z-80"></div>
|
||||
<div class="fixed inset-x-0 z-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">
|
||||
<div class="relative m-auto leading-7 max-w-7xl px-6 sm:px-14 md:px-24 lg:px-32">
|
||||
{{ partial "header/basic.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="min-h-[148px]"></div>
|
||||
<div class="fixed inset-x-0 pl-[24px] pr-[24px] z-100">
|
||||
<div class="fixed inset-x-0 z-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">
|
||||
<div class="relative m-auto leading-7 max-w-7xl px-6 sm:px-14 md:px-24 lg:px-32">
|
||||
{{ partial "header/basic.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<li class="mt-1">
|
||||
<a
|
||||
href="{{ .URL }}"
|
||||
{{ with or .Name .Pre }}aria-label="{{ . }}"{{ end }}
|
||||
class="flex items-center hover:text-primary-600 dark:hover:text-primary-400">
|
||||
{{ if .Pre }}
|
||||
<span {{ if and .Pre .Name }}class="mr-1"{{ end }}>
|
||||
@@ -24,6 +25,7 @@
|
||||
}}
|
||||
target="_blank"
|
||||
{{ end }}
|
||||
{{ with or .Name .Pre }}aria-label="{{ . }}"{{ end }}
|
||||
class="flex items-center hover:text-primary-600 dark:hover:text-primary-400">
|
||||
{{ if .Pre }}
|
||||
<span {{ if and .Pre .Name }}class="mr-1"{{ end }}>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
target="_blank"
|
||||
{{ end }}
|
||||
class="flex items-center hover:text-primary-600 dark:hover:text-primary-400"
|
||||
{{ with or .Name .Pre }}aria-label="{{ . }}"{{ end }}
|
||||
title="{{ .Title }}">
|
||||
{{ if .Pre }}
|
||||
<div {{ if and .Pre .Name }}class="mr-2"{{ end }}>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
target="_blank"
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ with or .Name .Pre }}aria-label="{{ . }}"{{ end }}
|
||||
class="text-base font-medium hover:text-primary-600 dark:hover:text-primary-400"
|
||||
title="{{ .Title }}">
|
||||
<p>
|
||||
@@ -31,6 +32,7 @@
|
||||
{{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }}
|
||||
target="_blank"
|
||||
{{ end }}
|
||||
{{ with or .Name .Pre }}aria-label="{{ . }}"{{ end }}
|
||||
class="flex items-center hover:text-primary-600 dark:hover:text-primary-400">
|
||||
{{ if .Pre }}
|
||||
<span {{ if and .Pre .Name }}class="mr-1"{{ end }}>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
href="{{ .URL }}"
|
||||
{{ if or (strings.HasPrefix .URL "http:" ) (strings.HasPrefix .URL "https:" ) }}target="_blank"{{ end }}
|
||||
class="flex items-center hover:text-primary-600 dark:hover:text-primary-400"
|
||||
{{ with or .Name .Pre }}aria-label="{{ . }}"{{ end }}
|
||||
title="{{ .Title }}">
|
||||
{{ if .Pre }}
|
||||
<span {{ if and .Pre .Name }}class="mr-1"{{ end }}>
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<img
|
||||
id="background-image"
|
||||
src="{{ . }}"
|
||||
alt=""
|
||||
alt="{{ $.Title }}"
|
||||
loading="eager"
|
||||
decoding="async"
|
||||
fetchpriority="high"
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<div class="overflow-hidden h-36 md:h-56 lg:h-72">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
alt=""
|
||||
alt="{{ with $.Params.featureimagealt }}{{ . }}{{ else }}{{ with $.Title }}Featured image for {{ . }}{{ else }}Featured image{{ end }}{{ end }}"
|
||||
loading="eager"
|
||||
decoding="async"
|
||||
fetchpriority="high"
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<div class="overflow-hidden rounded-md h-36 md:h-56 lg:h-72 nozoom">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
alt=""
|
||||
alt="{{ $.Title }}"
|
||||
loading="eager"
|
||||
decoding="async"
|
||||
fetchpriority="high"
|
||||
@@ -108,6 +108,7 @@
|
||||
id="background-image-main"
|
||||
src="{{ . }}"
|
||||
alt=""
|
||||
role="presentation"
|
||||
loading="eager"
|
||||
decoding="async"
|
||||
fetchpriority="high"
|
||||
|
||||
@@ -50,15 +50,17 @@
|
||||
{{ $authorImage = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ if $authorImage }}
|
||||
{{ $final := $authorImage }}
|
||||
{{ if not $disableImageOptimization }}
|
||||
{{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
|
||||
{{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
|
||||
{{ end }}
|
||||
<img
|
||||
class="mb-2 h-36 w-36 rounded-full"
|
||||
width="144"
|
||||
height="144"
|
||||
alt="{{ $.Site.Params.Author.name | default " Author" }}"
|
||||
src="{{ $authorImage.RelPermalink }}">
|
||||
alt="{{ $.Site.Params.Author.name | default `Author` }}"
|
||||
src="{{ $final.RelPermalink }}"
|
||||
data-zoom-src="{{ $authorImage.RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<h1 class="mb-2 text-4xl font-extrabold text-neutral-800 dark:text-neutral-200">
|
||||
|
||||
@@ -53,15 +53,17 @@
|
||||
{{ $authorImage = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ if $authorImage }}
|
||||
{{ $final := $authorImage }}
|
||||
{{ if not $disableImageOptimization }}
|
||||
{{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
|
||||
{{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
|
||||
{{ end }}
|
||||
<img
|
||||
class="mb-2 rounded-full h-36 w-36"
|
||||
class="mb-2 h-36 w-36 rounded-full"
|
||||
width="144"
|
||||
height="144"
|
||||
alt="{{ $.Site.Params.Author.name | default " Author" }}"
|
||||
src="{{ $authorImage.RelPermalink }}">
|
||||
alt="{{ $.Site.Params.Author.name | default `Author` }}"
|
||||
src="{{ $final.RelPermalink }}"
|
||||
data-zoom-src="{{ $authorImage.RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if not $disableHeroImageFilter }}
|
||||
|
||||
@@ -12,15 +12,17 @@
|
||||
{{ $authorImage = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ if $authorImage }}
|
||||
{{ $final := $authorImage }}
|
||||
{{ if not $disableImageOptimization }}
|
||||
{{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
|
||||
{{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
|
||||
{{ end }}
|
||||
<img
|
||||
class="mb-2 rounded-full h-36 w-36"
|
||||
class="mb-2 h-36 w-36 rounded-full"
|
||||
width="144"
|
||||
height="144"
|
||||
alt="{{ $.Site.Params.Author.name | default " Author" }}"
|
||||
src="{{ $authorImage.RelPermalink }}">
|
||||
alt="{{ $.Site.Params.Author.name | default `Author` }}"
|
||||
src="{{ $final.RelPermalink }}"
|
||||
data-zoom-src="{{ $authorImage.RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<h1 class="text-4xl font-extrabold">
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
{{ $showMoreLinkDest = .Site.Params.homepage.showMoreLinkDest }}
|
||||
{{ end }}
|
||||
<div class="mt-10 flex justify-center">
|
||||
<a href="{{ $showMoreLinkDest }}">
|
||||
<a href="{{ $showMoreLinkDest | relLangURL }}">
|
||||
<button
|
||||
class="bg-transparent hover:text-primary-500 prose dark:prose-invert font-semibold py-2 px-4 border border-primary-500 hover:border-transparent rounded">
|
||||
{{ i18n "recent.show_more" | markdownify }}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
{{ $coffeeIsRight := and site.Params.buymeacoffee.globalWidget (eq (lower site.Params.buymeacoffee.globalWidgetPosition) "right") }}
|
||||
{{ $toTopYOffset := cond $coffeeIsRight "bottom-24" "bottom-6" }}
|
||||
{{ $coffeeIsRight := and .Site.Params.buymeacoffee.globalWidget (eq (lower site.Params.buymeacoffee.globalWidgetPosition) "right") }}
|
||||
{{ $isRTL := .Site.Params.rtl | default false }}
|
||||
{{ $needAvoidCoffee := ne $coffeeIsRight $isRTL }}
|
||||
{{ $toTopYOffset := cond $needAvoidCoffee "bottom-24" "bottom-6" }}
|
||||
|
||||
|
||||
<div
|
||||
id="scroll-to-top"
|
||||
class="fixed {{ $toTopYOffset }} end-6 z-50 transform translate-y-4 opacity-0 duration-200">
|
||||
|
||||
@@ -33,12 +33,24 @@
|
||||
const TOC_LINK_SELECTOR = 'a[href^="#"]'
|
||||
const NESTED_LIST_SELECTOR = 'li ul'
|
||||
const ACTIVE_CLASS = 'active'
|
||||
let isJumpingToAnchor = false
|
||||
|
||||
function getActiveAnchorId(anchors, offsetRatio) {
|
||||
const threshold = window.scrollY + window.innerHeight * offsetRatio
|
||||
const tocLinks = [...document.querySelectorAll('#TableOfContents a[href^="#"]')]
|
||||
const tocIds = new Set(tocLinks.map(link => link.getAttribute('href').substring(1)))
|
||||
|
||||
if (isJumpingToAnchor) {
|
||||
for (let i = 0; i < anchors.length; i++) {
|
||||
const anchor = anchors[i]
|
||||
if (!tocIds.has(anchor.id)) continue
|
||||
const top = anchor.getBoundingClientRect().top + window.scrollY
|
||||
if (Math.abs(window.scrollY - top) < 100) {
|
||||
return anchor.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = anchors.length - 1; i >= 0; i--) {
|
||||
const top = anchors[i].getBoundingClientRect().top + window.scrollY
|
||||
if (top <= threshold && tocIds.has(anchors[i].id)) {
|
||||
@@ -85,6 +97,12 @@
|
||||
toc.querySelectorAll(NESTED_LIST_SELECTOR).forEach(ul => ul.style.display = 'none')
|
||||
}
|
||||
|
||||
links.forEach(link => {
|
||||
link.addEventListener('click', () => {
|
||||
isJumpingToAnchor = true
|
||||
})
|
||||
})
|
||||
|
||||
const config = {
|
||||
toc,
|
||||
anchors,
|
||||
|
||||
@@ -149,8 +149,9 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $repoCardCSS := resources.FromString "css/repo-cards.css" (delimit $cssRules "\n")
|
||||
| minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512")
|
||||
}}
|
||||
{{ $cssContent := delimit $cssRules "\n" }}
|
||||
{{ $outputPath := path.Join .Page.RelPermalink "repo-cards.css" }}
|
||||
{{ $repoCardCSS := resources.FromString $outputPath $cssContent | minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||
|
||||
<link rel="stylesheet" href="{{ $repoCardCSS.RelPermalink }}" integrity="{{ $repoCardCSS.Data.Integrity }}">
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user