Update Theme

This commit is contained in:
Daniel Mason 2024-04-07 14:32:03 +12:00
parent a212477863
commit d47be661bd
Signed by: idanoo
GPG key ID: 387387CDBC02F132
212 changed files with 13069 additions and 8406 deletions

View file

@ -1,10 +1,10 @@
{{- if .Title -}}
<figure>
{{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
{{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/img.html" -}}
<figcaption class="image-caption">
{{- .Title | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/image.html" -}}
{{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/img.html" -}}
{{- end -}}

View file

@ -3,4 +3,4 @@
{{- $destination = .RelPermalink -}}
{{- end -}}
{{- $options := dict "Destination" $destination "Title" .Title "Content" .Text -}}
{{- partial "plugin/link.html" $options -}}
{{- partial "plugin/a.html" $options -}}

View file

@ -6,9 +6,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noodp" />
<title>
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
</title>
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{- partial "head/meta.html" . -}}
{{- partial "head/link.html" . -}}

View file

@ -22,7 +22,7 @@
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
{{- .Title | emojify -}}
</a>
<span class="archive-item-date">
{{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}}

View file

@ -12,14 +12,14 @@
{{- with $image -}}
<div class="featured-image-preview">
<a href="{{ $.RelPermalink }}">
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/img.html" -}}
</a>
</div>
{{- end -}}
{{- /* Title */ -}}
<h1 class="single-title" itemprop="name headline">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
<a href="{{ .RelPermalink }}">{{ .Title | emojify }}</a>
</h1>
{{- /* Meta */ -}}
@ -28,7 +28,7 @@
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
{{- partial "plugin/link.html" $options -}}
{{- partial "plugin/a.html" $options -}}
</span>
{{- with .Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format -}}

View file

@ -3,10 +3,6 @@
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
{{- $config := (.Scratch.Get "this").config -}}
{{- /* Smooth Scroll */ -}}
{{- $source := $cdn.smoothScrollJS | default "lib/smooth-scroll/smooth-scroll.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- /* Search */ -}}
{{- if .Site.Params.search | and .Site.Params.search.enable -}}
{{- $search := .Site.Params.search -}}
@ -37,8 +33,6 @@
{{- /* lazysizes */ -}}
{{- $source := $cdn.lazysizesJS | default "lib/lazysizes/lazysizes.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lazysizesParentFitJS | default "lib/lazysizes/ls.parent-fit.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- /* twemoji */ -}}
{{- if $params.twemoji -}}
@ -47,17 +41,17 @@
{{- $config = dict "twemoji" true | merge $config -}}
{{- end -}}
{{- /* lightgallery.js */ -}}
{{- /* lightgallery */ -}}
{{- if $params.lightgallery -}}
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/lightgallery.min.css" -}}
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/lg-thumbnail.min.js" -}}
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/plugins/thumbnail/lg-thumbnail.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/lg-zoom.min.js" -}}
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/plugins/zoom/lg-zoom.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false | dict "lightGallery" | merge $config -}}
{{- $config = dict "lightgallery" true | merge $config -}}
{{- end -}}
{{- $code := $params.code | default dict -}}
@ -79,7 +73,7 @@
{{- /* TypeIt */ -}}
{{- with (.Scratch.Get "this").typeitMap -}}
{{- $typeit := $.Site.Params.typeit -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}}
{{- end -}}
@ -96,16 +90,14 @@
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/contrib/auto-render.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- if $math.copyTex -}}
{{- $source := $cdn.katexCopyTexCSS | default "lib/katex/copy-tex.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}}
{{- $source := $cdn.katexCopyTexJS | default "lib/katex/contrib/copy-tex.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- if $math.mhchem -}}
{{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}}
{{- $source := $cdn.katexMhchemJS | default "lib/katex/contrib/mhchem.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}}
@ -138,8 +130,9 @@
{{- if (.Scratch.Get "this").echarts -}}
{{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.echartsMacaronsJS | default "lib/echarts/macarons.js" -}}
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $lightTheme := resources.Get "lib/echarts/theme/light.yml" | transform.Unmarshal -}}
{{- $darkTheme := resources.Get "lib/echarts/theme/dark.yml" | transform.Unmarshal -}}
{{- $config = dict "lightTheme" $lightTheme "darkTheme" $darkTheme | dict "echarts" | merge $config -}}
{{- end -}}
{{- /* Mapbox GL */ -}}

View file

@ -51,7 +51,7 @@
{{- with $valine.serverURLs -}}
{{- $commentConfig = dict "serverURLs" . | dict "valine" | merge $commentConfig -}}
{{- end -}}
{{- $commentConfig = $valine.emoji | default "google.yml" | printf "data/emoji/%v" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}}
{{- $commentConfig = $valine.emoji | default "google.yml" | printf "lib/valine/emoji/%v" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://valine.js.org/">Valine</a>.
</noscript>
@ -77,51 +77,73 @@
{{- /* Telegram Comments System */ -}}
{{- $telegram := $comment.telegram | default dict -}}
{{- if $telegram.enable -}}
<div id="telegram-comments" class="comment"></div>
{{- $attr := printf `data-comments-app-website="%v"` $telegram.siteID -}}
{{- $attr = printf `%v data-limit="%v"` $attr ($telegram.limit | default 5) -}}
{{- with $telegram.height -}}
{{- $attr = printf `%v data-height="%v"` $attr . -}}
{{- end -}}
{{- with $telegram.color -}}
{{- $attr = printf `%v data-color="%v"` $attr . -}}
{{- end -}}
{{- if $telegram.colorful -}}
{{- $attr = printf `%v data-colorful="1"` $attr -}}
{{- end -}}
{{- if $telegram.dislikes -}}
{{- $attr = printf `%v data-dislikes="1"` $attr -}}
{{- end -}}
{{- if $telegram.outlined -}}
{{- $attr = printf `%v data-outlined="1"` $attr -}}
{{- end -}}
{{- dict "Source" "https://comments.app/js/widget.js?2" "Defer" true "Attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
</noscript>
<div id="telegram-comments" class="comment">
{{- $attr := printf `data-comments-app-website="%v"` $telegram.siteID -}}
{{- $attr = printf `%v data-limit="%v"` $attr ($telegram.limit | default 5) -}}
{{- with $telegram.height -}}
{{- $attr = printf `%v data-height="%v"` $attr . -}}
{{- end -}}
{{- with $telegram.color -}}
{{- $attr = printf `%v data-color="%v"` $attr . -}}
{{- end -}}
{{- if $telegram.colorful -}}
{{- $attr = printf `%v data-colorful="1"` $attr -}}
{{- end -}}
{{- if $telegram.dislikes -}}
{{- $attr = printf `%v data-dislikes="1"` $attr -}}
{{- end -}}
{{- if $telegram.outlined -}}
{{- $attr = printf `%v data-outlined="1"` $attr -}}
{{- end -}}
{{- dict "Source" "https://comments.app/js/widget.js?3" "Defer" true "Attr" $attr | partial "plugin/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
</noscript>
</div>
{{- end -}}
{{- /* Commento Comment System */ -}}
{{- $commento := $comment.commento | default dict -}}
{{- if $commento.enable -}}
<div id="commento"></div>
<div id="commento" class="comment"></div>
{{- dict "Source" "https://cdn.commento.io/js/commento.js" "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>.
</noscript>
{{- end -}}
{{- /* Utterances Comment System */ -}}
{{- /* utterances Comment System */ -}}
{{- $utterances := $comment.utterances | default dict -}}
{{- if $utterances.enable -}}
<div id="utterances"></div>
<div id="utterances" class="comment"></div>
{{- $commentConfig = dict "repo" $utterances.repo | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.issueTerm | default "pathname" | dict "issueTerm" | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = dict "label" $utterances.label | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.lightTheme | default "github-light" | dict "lightTheme" | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.darkTheme | default "github-dark" | dict "darkTheme" | dict "utterances" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://utteranc.es/">Utterances</a>.
Please enable JavaScript to view the comments powered by <a href="https://utteranc.es/">utterances</a>.
</noscript>
{{- end -}}
{{- /* giscus Comment System */ -}}
{{- $giscus := $comment.giscus | default dict -}}
{{- if $giscus.enable -}}
<div id="giscus" class="comment"></div>
{{- $commentConfig = dict "repo" $giscus.repo | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = dict "repoId" $giscus.repoId | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = dict "category" $giscus.category | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = dict "categoryId" $giscus.categoryId | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.lang | default (T "valineLang") | dict "lang" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.mapping | default "pathname" | dict "mapping" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.reactionsEnabled | default "1" | dict "reactionsEnabled" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.emitMetadata | default "0" | dict "emitMetadata" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.inputPosition | default "bottom" | dict "inputPosition" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.lazyLoading | default false | dict "lazyLoading" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.lightTheme | default "github-light" | dict "lightTheme" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = $giscus.darkTheme | default "github-dark" | dict "darkTheme" | dict "giscus" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://giscus.app">Giscus</a>.
</noscript>
{{- end -}}
</div>

View file

@ -29,23 +29,18 @@
<link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
{{- end -}}
{{- /* normalize.css */ -}}
{{- $source := $cdn.normalizeCSS | default "lib/normalize/normalize.min.css" -}}
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
{{- partial "plugin/style.html" $style -}}
{{- /* style.min.css */ -}}
{{- $style := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}}
{{- $options := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
{{- $style = dict "Context" . "ToCSS" $options | merge $style -}}
{{- partial "plugin/style.html" $style -}}
{{- $options := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}}
{{- $toCSS := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}}
{{- partial "plugin/style.html" $options -}}
{{- /* Font Awesome */ -}}
{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}}
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
{{- partial "plugin/style.html" $style -}}
{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}}
{{- partial "plugin/style.html" $options -}}
{{- /* Animate.css */ -}}
{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}}
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
{{- partial "plugin/style.html" $style -}}
{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}}
{{- partial "plugin/style.html" $options -}}

View file

@ -5,7 +5,7 @@
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}}
{{- dict "Src" . "Class" "logo" | partial "plugin/img.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
@ -39,29 +39,7 @@
{{- if .Site.Menus.main -}}
<span class="menu-item delimiter"></span>
{{- end -}}
{{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item language" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}
<i class="fas fa-chevron-right fa-fw" aria-hidden="true"></i>
<select class="language-select" id="language-select-desktop" onchange="location = this.value;">
{{- if eq .Kind "404" -}}
{{- /* https://github.com/dillonzq/LoveIt/issues/378 */ -}}
{{- range .Sites -}}
{{- $link := printf "%v/404.html" .LanguagePrefix -}}
<option value="{{ $link }}"{{ if eq . $.Site }} selected{{ end }}>
{{- .Language.LanguageName -}}
</option>
{{- end -}}
{{- else -}}
{{- range .AllTranslations -}}
<option value="{{ .RelPermalink }}"{{ if eq .Lang $.Lang }} selected{{ end }}>
{{- .Language.LanguageName -}}
</option>
{{- end -}}
{{- end -}}
</select>
</a>
{{- end -}}
{{- if .Site.Params.search.enable -}}
<span class="menu-item search" id="search-desktop">
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `searchPlaceholder`) }}" id="search-input-desktop">
@ -79,6 +57,28 @@
<a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
<i class="fas fa-adjust fa-fw" aria-hidden="true"></i>
</a>
{{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item language" title="{{ T "selectLanguage" }}">
<i class="fa fa-globe" aria-hidden="true"></i>
<select class="language-select" id="language-select-desktop" onchange="location = this.value;">
{{- if eq .Kind "404" -}}
{{- /* https://github.com/dillonzq/LoveIt/issues/378 */ -}}
{{- range .Sites -}}
{{- $link := printf "%v/404.html" .LanguagePrefix -}}
<option value="{{ $link }}"{{ if eq . $.Site }} selected{{ end }}>
{{- .Language.LanguageName -}}
</option>
{{- end -}}
{{- else -}}
{{- range .AllTranslations -}}
<option value="{{ .RelPermalink }}"{{ if eq .Lang $.Lang }} selected{{ end }}>
{{- .Language.LanguageName -}}
</option>
{{- end -}}
{{- end -}}
</select>
</a>
{{- end -}}
</div>
</div>
</div>
@ -92,7 +92,7 @@
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}}
{{- dict "Src" . "Class" "logo" | partial "plugin/img.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
@ -150,9 +150,9 @@
<i class="fas fa-adjust fa-fw" aria-hidden="true"></i>
</a>
{{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}
<i class="fas fa-chevron-right fa-fw" aria-hidden="true"></i>
<i class="fa fa-globe fa-fw" aria-hidden="true"></i>
<select class="language-select" onchange="location = this.value;">
{{- if eq .Kind "404" -}}
{{- /* https://github.com/dillonzq/LoveIt/issues/378 */ -}}

View file

@ -13,10 +13,10 @@
{{- $url = .RelPermalink -}}
{{- end -}}
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
{{- dict "Src" $avatar | partial "plugin/img.html" -}}
</a>
{{- else -}}
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
{{- dict "Src" $avatar | partial "plugin/img.html" -}}
{{- end -}}
</div>
{{- end -}}
@ -34,7 +34,7 @@
<div id="{{ $id }}" class="typeit"></div>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
{{- . -}}
{{- . | safeHTML -}}
{{- end -}}
</div>
{{- end -}}
@ -71,6 +71,9 @@
{{- with $value.icon -}}
{{- $social = dict "Icon" . | merge $social -}}
{{- end -}}
{{- with $value.rel -}}
{{- $social = dict "Rel" . | merge $social -}}
{{- end -}}
{{- else if ne $value true -}}
{{- $social = dict "Id" $value | merge $social -}}
{{- end -}}

View file

@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "0.2.10" -}}
{{- .Scratch.Set "version" "0.2.11" -}}
{{- $params := .Params | merge .Site.Params.page -}}

View file

@ -1,9 +1,9 @@
{{- $rel := "" -}}
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .Destination).Host | or .Newtab }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"{{ with .Class }} class="{{ . }}"{{ end }}>
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .Destination).Host | or .Newtab }}{{ $rel = "noopener noreffer " }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .Rel }}{{ . }}{{ end }}"{{ with .Class }} class="{{ . }}"{{ end }}>
{{- with .Icon -}}
{{- partial "plugin/icon.html" . -}}
{{- end -}}
{{- with .Content -}}
{{- . | safeHTML -}}
{{- end -}}
</a>
</a>

View file

@ -19,4 +19,25 @@
</script>
{{- dict "Source" ($analytics.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "Async" true "Attr" "id=fathom-script" | partial "plugin/script.html" -}}
{{- end -}}
{{- /* Plausible Analytics */ -}}
{{- with $analytics.plausible.dataDomain -}}
{{- dict "Source" "https://plausible.io/js/plausible.js" "Async" true "Defer" true "Attr" ($analytics.plausible.dataDomain | printf `data-domain="%v"`) | partial "plugin/script.html" -}}
{{- end -}}
{{- /* Yandex Metrica */ -}}
{{- with $analytics.yandexMetrica.id -}}
<script type="text/javascript" >
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym({{ . }}, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true
});
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/{{ . }}" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
{{- end -}}
{{- end -}}

View file

@ -0,0 +1,15 @@
{{- $rel := .Rel -}}
{{- $nick := .Nickname -}}
{{- $text := .Text -}}
{{- $n := .Nickname | default .Name | default .Email | default .URL | default "👀" -}}
<span class="h-card{{ with .Class }} {{ . }}{{- end -}}">
{{- with .URL -}}<a href="{{ . }}" class="u-url url"{{ with $rel }} rel="{{ . }}"{{- end -}}{{ with $text }} title="{{ . }}"{{ end }}>{{- else -}}{{- with .Email -}}<a href="mailto:{{ . }}" class="email"{{ with $text }} title="{{ . }}"{{ end }}>{{- end -}}{{- end -}}
{{- with .Image -}}<img class="u-photo photo" src="{{ . }}" alt="{{ $n }}">{{- else -}}<i class="far fa-user-circle" aria-hidden="true"></i>{{ end -}}&#8201;
{{- with .Name -}}<span class="p-name fn">{{ . }}</span>{{ with $nick }} ({{- end -}}{{- end -}}
{{- with .Nickname -}}<span class="p-nickname nickname">{{ . }}</span>{{- end -}}
{{- with .Name -}}{{ with $nick }}){{- end -}}{{- end -}}
{{- with .URL -}}</a>{{- else -}}{{- with .Email -}}</a>{{- end -}}{{- end -}}
{{- with .Email }}
<a href="mailto:{{ . }}" class="email"><span class="u-email">{{ . }}</span></a>
{{- end -}}
</span>

View file

@ -1,7 +1,11 @@
{{- /* lazysizes and lightgallery.js */ -}}
{{- /* lazysizes and lightgallery */ -}}
{{- $src := .Src -}}
{{- with dict "Path" .Src "Resources" .Resources | partial "function/resource.html" -}}
{{- $width := .Width -}}
{{- $height := .Height -}}
{{- with dict "Path" $src "Resources" .Resources | partial "function/resource.html" -}}
{{- $src = .RelPermalink -}}
{{- $width = $width | default .Width -}}
{{- $height = $height | default .Height -}}
{{- end -}}
{{- $small := .SrcSmall | default $src -}}
@ -21,18 +25,22 @@
<img
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
src="{{ $loading.RelPermalink }}"
data-src="{{ .Src | safeURL }}"
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-src="{{ $src | safeURL }}"
data-srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-sizes="auto"
alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
alt="{{ $alt }}"
{{- with $width }} width="{{ . }}"{{ end }}
{{- with $height }} height="{{ . }}"{{ end }} />
</a>
{{- else -}}
<img
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
src="{{ $loading.RelPermalink }}"
data-src="{{ .Src | safeURL }}"
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-src="{{ $src | safeURL }}"
data-srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
data-sizes="auto"
alt="{{ $alt }}"
title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
title="{{ .Title | default $alt }}"
{{- with $width }} width="{{ . }}"{{ end }}
{{- with $height }} height="{{ . }}"{{ end }} />
{{- end -}}

View file

@ -1,25 +1,41 @@
{{- if .Content -}}
<script type="text/javascript">
{{- .Content | safeJS -}}
</script>
{{- else if strings.HasPrefix .Source "<script" -}}
{{- safeHTML .Source -}}
{{- with .Content -}}
<script type="text/javascript">{{ . | safeJS }}</script>
{{- else -}}
{{- $src := .Source -}}
{{- $integrity := .Integrity -}}
{{- if (urls.Parse $src).Host | not -}}
{{- $resource := resources.Get $src -}}
{{- with .Template -}}
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
{{- if strings.HasPrefix .Source "<script" -}}
{{- safeHTML .Source -}}
{{- else -}}
{{- $src := .Source -}}
{{- $integrity := .Integrity -}}
{{- if (urls.Parse $src).Host | not -}}
{{- $resource := resources.Get $src -}}
{{- with .Template -}}
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
{{- end -}}
{{- if .Minify -}}
{{- $resource = $resource | minify -}}
{{- end -}}
{{- with .Fingerprint -}}
{{- $resource = $resource | fingerprint . -}}
{{- $integrity = $resource.Data.Integrity -}}
{{- end -}}
{{- $src = $resource.RelPermalink -}}
{{- end -}}
{{- if .Minify -}}
{{- $resource = $resource | minify -}}
{{- $attrs := printf `src="%v"` $src -}}
{{- if .Crossorigin -}}
{{- $attrs = ` crossorigin="anonymous"` | add $attrs -}}
{{- end -}}
{{- with .Fingerprint -}}
{{- $resource = $resource | fingerprint . -}}
{{- $integrity = $resource.Data.Integrity -}}
{{- with $integrity -}}
{{- $attrs = printf ` integrity="%v"` . | add $attrs -}}
{{- end -}}
{{- $src = $resource.RelPermalink -}}
{{- if .Async -}}
{{- $attrs = " async" | add $attrs -}}
{{- end -}}
{{- if .Defer -}}
{{- $attrs = " defer" | add $attrs -}}
{{- end -}}
{{- with .Attr -}}
{{- $attrs = add " " . | add $attrs -}}
{{- end -}}
<script type="text/javascript" {{ $attrs | safeHTMLAttr }}></script>
{{- end -}}
<script type="text/javascript" src="{{ $src }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ if .Async }} async{{ end }}{{ if .Defer }} defer{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}></script>
{{- end -}}

View file

@ -8,4 +8,8 @@
{{- end -}}
{{- $destination = printf (string $template) .Id -}}
{{- end -}}
{{- dict "Destination" $destination "Rel" "me" | merge . | partial "plugin/link.html" -}}
{{- $rel := "me" -}}
{{- with .Rel -}}
{{- $rel = printf "%v %v" $rel . -}}
{{- end -}}
{{- dict "Destination" $destination "Rel" $rel | merge . | partial "plugin/a.html" -}}

View file

@ -27,5 +27,20 @@
{{- end -}}
{{- $href = $resource.RelPermalink -}}
{{- end -}}
<link rel="stylesheet" href="{{ $href }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}>
{{- $attrs := printf `href="%v"` $href -}}
{{- if .Crossorigin -}}
{{- $attrs = ` crossorigin="anonymous"` | add $attrs -}}
{{- end -}}
{{- with $integrity -}}
{{- $attrs = printf ` integrity="%v"` . | add $attrs -}}
{{- end -}}
{{- with .Attr -}}
{{- $attrs = add " " . | add $attrs -}}
{{- end -}}
{{- if .Preload -}}
<link rel="preload" {{ $attrs | safeHTMLAttr }} as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" {{ $attrs | safeHTMLAttr }}></noscript>
{{- else -}}
<link rel="stylesheet" {{ $attrs | safeHTMLAttr }}>
{{- end -}}
{{- end -}}

View file

@ -62,11 +62,24 @@
</div>
<div class="post-nav">
{{- if .PrevInSection -}}
<a href="{{ .PrevInSection.RelPermalink }}" class="prev" rel="prev" title="{{ .PrevInSection.Title }}"><i class="fas fa-angle-left fa-fw" aria-hidden="true"></i>{{ .PrevInSection.Title }}</a>
{{- $prevPage := false -}}
{{- $nextPage := false -}}
{{- if or (.Params.prev) (.Params.next) -}}
{{- with .Params.prev -}}
{{- $prevPage = $.Site.GetPage . -}}
{{- end -}}
{{- with .Params.next -}}
{{- $nextPage = $.Site.GetPage . -}}
{{- end -}}
{{- else -}}
{{- $prevPage = .PrevInSection -}}
{{- $nextPage = .NextInSection -}}
{{- end -}}
{{ if .NextInSection }}
<a href="{{ .NextInSection.RelPermalink }}" class="next" rel="next" title="{{ .NextInSection.Title }}">{{ .NextInSection.Title }}<i class="fas fa-angle-right fa-fw" aria-hidden="true"></i></a>
{{- with $prevPage -}}
<a href="{{ .RelPermalink }}" class="prev" rel="prev" title="{{ .Title }}"><i class="fas fa-angle-left fa-fw" aria-hidden="true"></i>{{ .Title | emojify }}</a>
{{- end -}}
{{ with $nextPage }}
<a href="{{ .RelPermalink }}" class="next" rel="next" title="{{ .Title }}">{{ .Title | emojify }}<i class="fas fa-angle-right fa-fw" aria-hidden="true"></i></a>
{{- end -}}
</div>
</div>

View file

@ -20,7 +20,7 @@
<article class="page single">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__flipInX">{{ .Title }}</h1>
<h1 class="single-title animate__animated animate__flipInX">{{ .Title | emojify }}</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}
@ -34,7 +34,7 @@
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
{{- partial "plugin/link.html" $options -}}
{{- partial "plugin/a.html" $options -}}
</span>
{{- $categories := slice -}}
@ -70,7 +70,7 @@
{{- end -}}
{{- with $image -}}
<div class="featured-image">
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/img.html" -}}
</div>
{{- end -}}

View file

@ -19,11 +19,11 @@
{{- with $caption -}}
<figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}>
{{- partial "plugin/image.html" $options -}}
{{- partial "plugin/img.html" $options -}}
<figcaption class="image-caption">
{{- . | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- partial "plugin/image.html" $options -}}
{{- partial "plugin/img.html" $options -}}
{{- end -}}

View file

@ -12,4 +12,4 @@
{{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}}
{{- $options = dict "Title" (.Get 2) | merge $options -}}
{{- end -}}
{{- partial "plugin/link.html" $options -}}
{{- partial "plugin/a.html" $options -}}

View file

@ -0,0 +1,9 @@
{{- $url := cond .IsNamedParams (.Get "url") (.Get 0) -}}
{{- $name := cond .IsNamedParams (.Get "name") (.Get 1) -}}
{{- $text := cond .IsNamedParams (.Get "text") (.Get 2) -}}
{{- $pic := cond .IsNamedParams (.Get "picture") (.Get 3) -}}
{{- $options := dict "Class" "person-mention" "Name" $name "URL" $url "Text" $text "Image" $pic -}}
{{- if .IsNamedParams -}}
{{- $options = dict "Nickname" (.Get "nick") | merge $options -}}
{{- end -}}
{{- partial "plugin/h-card" $options -}}

View file

@ -1,18 +1,21 @@
{{- $content := trim .Inner "\n" -}}
{{- $classList := .Get "class" | slice -}}
{{- $classList := slice -}}
{{- with .Get "class" -}}
{{- $classList = $classList | append . -}}
{{- end -}}
{{- $tag := .Get "tag" | default "div" -}}
{{- with .Get "code" -}}
{{- if .Get "code" -}}
{{- /* highlight code content without line number */ -}}
{{- $content = highlight $content . "linenos=false" -}}
{{- $content = highlight $content (.Get "code") "lineNos=false, noClasses=false" -}}
{{- /* delete outer label */ -}}
{{- $content = replaceRE `<div class="highlight"><pre class="chroma"><code[^<>]*>(?s)(.*)</code></pre></div>` "$1" $content -}}
{{- /* parsing markdown links */ -}}
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=$4>$3</a>$1$5$6" $content -}}
{{- /* replace " " to "&nbsp;" and replace "\n" to "<br />" */ -}}
{{- $content = replaceRE ` ` "&nbsp;" $content | replaceRE `(<\w+)&nbsp;` "$1 " | replaceRE `\n` "<br />" -}}
{{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}}
{{- $content = replaceRE `<br /></span>` "</span><br />" $content -}}
{{- $content = replaceRE `.*<code[^<>]*>(?s)(.*)</code>.*` "$1" $content -}}
{{- if .Get "code-link" -}}
{{- /* parsing code links */ -}}
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=\"$4\">$3</a>$1$5$6" $content -}}
{{- end -}}
{{- /* split multiline string */ -}}
{{- $content = split $content "\n" -}}
{{- $classList = $classList | append "highlight" -}}
{{- else -}}
{{- $content = $content | .Page.RenderString -}}
@ -26,6 +29,11 @@
{{- $group = $group | default slice | append $id -}}
{{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}}
{{- $attrs := printf `id="%v"` $id -}}
{{- with $classList -}}
{{- $attrs = delimit $classList " " | printf `%v class="%v"` $attrs -}}
{{- end -}}
<div class="typeit">
{{- printf `<%v id="%v" class="%v"></%v>` $tag $id (delimit $classList " ") $tag | safeHTML -}}
{{- printf `<%v %v></%v>` $tag $attrs $tag | safeHTML -}}
</div>

View file

@ -9,5 +9,5 @@
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
{{- $alt := printf "LoveIt %v | %v" $label $version -}}
<a href="{{ $url }}" rel="noopener noreffer" target="_blank">
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/img.html" -}}
</a>

View file

@ -29,7 +29,7 @@
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
{{- .Title | emojify -}}
</a>
<span class="archive-item-date">
{{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}}

View file

@ -30,7 +30,7 @@
{{- range first 5 $pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
{{- .Title | emojify -}}
</a>
</article>
{{- end -}}