redesign 2023

This commit is contained in:
m3tam3re
2023-10-12 14:01:05 +02:00
commit 19bfc7311a
3053 changed files with 76380 additions and 0 deletions

View File

@ -0,0 +1,21 @@
{{- define "title" -}}
{{- T "pageNotFound" | printf "404 %v" }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}
<article class="page" id="content-404">
<h1 id="error-emoji"></h1>
<p class="error-text">
{{- T "pageNotFoundText" -}}&nbsp;
<a href="javascript:void(0);" title="{{ T `back` }}" onclick="window.history.back();">
{{- dict "Class" "fa-regular fa-hand-point-left fa-fw" | partial "plugin/icon.html" -}}
</a>
</p>
</article>
<script>
(function() {
const emojiArray = ['\\(o_o)/', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)','(=\'X\'=)', '(>_<)', '(;-;)'];
document.getElementById('error-emoji').appendChild(document.createTextNode(emojiArray[Math.floor(Math.random() * emojiArray.length)]));
})();
</script>
{{- end -}}

View File

@ -0,0 +1,3 @@
{{- $id := dict "Content" (trim (partial "function/dos2unix.html" .Inner) "\n") "Scratch" .Page.Scratch | partial "function/id.html" -}}
<div class="mermaid" id="{{ $id }}"></div>
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}}

View File

@ -0,0 +1,3 @@
{{- $id := dict "Content" .Attributes "Scratch" .Page.Scratch | partial "function/id.html" -}}
{{- $codeBlock := transform.Highlight .Inner .Type .Options -}}
{{- replace $codeBlock "<div class=\"highlight\">" (printf "<div class=\"highlight\" id=\"%v\">" $id) 1 | safeHTML -}}

View File

@ -0,0 +1,11 @@
{{- if .Title -}}
<figure>
{{- dict "Src" .Destination "Alt" .Text "Caption" .Text "Title" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
<figcaption class="image-caption">
{{- .Text | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- $linked := (eq .Page.Site.Params.page.lightgallery "force") | or (eq .Page.Params.lightgallery "force") -}}
{{- dict "Src" .Destination "Alt" .Text "Linked" $linked "Resources" .Page.Resources | partial "plugin/image.html" -}}
{{- end -}}

View File

@ -0,0 +1,6 @@
{{- $destination := .Destination -}}
{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}}
{{- $destination = .RelPermalink -}}
{{- end -}}
{{- $options := dict "Destination" $destination "Title" .Title "Content" .Text "ExternalIcon" .Page.Site.Params.externalIcon -}}
{{- partial "plugin/link.html" $options -}}

View File

@ -0,0 +1,40 @@
{{- partial "init/index.html" . -}}
<!DOCTYPE html>
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.LanguageCode }}">
<head>
{{ if .IsHome | and (ne .Site.Params.disableThemeInject true) }}
<meta name="theme" content='FixIt {{ .Scratch.Get "version" }}'>
{{ end }}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="robots" content="noodp" />
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{- partial "head/meta.html" . -}}
{{- partial "head/link.html" . -}}
{{- partial "head/seo.html" . -}}
</head>
<body data-header-desktop="{{ .Site.Params.header.desktopMode }}" data-header-mobile="{{ .Site.Params.header.mobileMode }}">
{{- /* Check theme isDark before body rendering */ -}}
{{- $theme := .Site.Params.defaulttheme -}}
<script>(window.localStorage?.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('data-theme', 'dark');</script>
{{- /* Body wrapper */ -}}
<div class="wrapper" data-page-style="{{ (.Scratch.Get `params`).pageStyle | default `normal` }}">
{{- partial "header.html" . -}}
{{- partial "breadcrumb.html" . -}}
{{- $toc := .Scratch.Get "toc" -}}
<main class="container{{ if (eq $toc.enable true) | and (eq $toc.position `left`) }} container-reverse{{ end }}">
{{- block "content" . }}{{ end -}}
</main>
{{- partial "footer.html" . -}}
</div>
{{- /* Theme widgets */ -}}
{{- partial "widgets.html" . -}}
{{- /* Load JavaScript scripts and CSS */ -}}
{{- partial "assets.html" . -}}
</body>
</html>

View File

@ -0,0 +1,53 @@
{{- define "title" }}
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}
<div class="page archive">
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__pulse animate__faster">
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }}
<sup>{{- len .Pages -}}</sup>
</h1>
{{- /* Total word count */ -}}
{{- /* See https://github.com/hugo-fixit/FixIt/issues/124 */ -}}
{{- $localData := newScratch -}}
{{- range .Pages -}}
{{- $localData.Add "totalWordCount" .WordCount -}}
{{- end -}}
{{- with ($localData.Get "totalWordCount") -}}
{{- $humanizedNum := . -}}
{{- if ge $humanizedNum 1000 -}}
{{- $humanizedNum = printf "%.2fK" (div $humanizedNum 1000.0) -}}
{{- end -}}
<p class="single-subtitle total-word-count" title='{{- T "taxonomy.totalwordCount" 1 }}'>
{{- dict "Class" "fa-regular fa-keyboard fa-fw" | partial "plugin/icon.html" }} {{ T "taxonomy.totalwordCount" (dict "Count" $humanizedNum) -}}
</p>
{{- end -}}
</div>
{{- /* Paginate */ -}}
{{- if .Pages -}}
{{- $pages := .Pages.GroupByDate "2006" -}}
{{- with .Site.Params.section.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}}
{{- else -}}
{{- $pages = .Paginate $pages -}}
{{- end -}}
{{- partial "recently-updated.html" . -}}
{{- range $pages.PageGroups -}}
<h2 class="group-title">{{ .Key }}</h2>
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}}
</span>
</article>
{{- end -}}
{{- end -}}
{{- partial "paginator.html" . -}}
{{- end -}}
</div>
{{- end -}}

View File

@ -0,0 +1,42 @@
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}
<article class="page single special">
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__pulse animate__faster">{{- .Title -}}</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . }}</p>{{- end -}}
</div>
{{- /* Content */ -}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- if $params.password -}}
{{- $saltLen := strings.RuneCount (trim $params.password "") -}}
{{- $saltLen = cond (eq (mod $saltLen 2) 0) (add $saltLen 1) $saltLen -}}
{{- $base64EncodeContent := $content | base64Encode -}}
{{- $content = printf "%v%v%v"
(substr $base64EncodeContent 0 $saltLen)
(substr (sha256 $params.password) $saltLen)
(substr $base64EncodeContent $saltLen)
-}}
{{- end -}}
<div
class="content"
id="content"
{{ with $params.password }}data-password="{{ md5 $params.password }}"{{ end }}
{{ with $params.password }}data-content="{{ $content }}"{{ end }}
>
{{- if not $params.password -}}
{{- $content -}}
{{- else -}}
{{- partial "single/fixit-decryptor.html" . -}}
{{- end -}}
</div>
{{- /* Comment */ -}}
{{- partial "single/comment.html" . -}}
</article>
{{- end -}}

View File

@ -0,0 +1,15 @@
{{- $params := .Scratch.Get "params" -}}
{{- $author := .Scratch.Get "author" -}}
# {{ .Title }}
{{ if $params.password -}}
***{{ T "single.encryptedAbstract" }}***
{{- else -}}
{{ .RawContent | replaceRE "\n?{{% fixit-encryptor .+ %}}((\n|.)*){{% /fixit-encryptor %}}\n?" "" }}
{{- end }}
---
> {{ T "single.author"}}: {{ with $author.link }}[{{ $author.name }}]({{ . }}){{ else }}{{ $author.name }}{{ end }}
> URL: {{ .Permalink }}
{{ if $params.repost.enable | and (hasPrefix $params.repost.url "http") }}> {{ T "single.repost" }} URL: {{ $params.repost.url }}{{ end }}

View File

@ -0,0 +1,79 @@
{{- $params := .Params | merge .Site.Params.page -}}
<article class="single summary" itemscope itemtype="http://schema.org/Article">
{{- /* Featured image */ -}}
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}}
{{- with .Resources.GetMatch "featured-image" -}}
{{- $image = .RelPermalink -}}
{{- end -}}
{{- with .Resources.GetMatch "featured-image-preview" -}}
{{- $image = .RelPermalink -}}
{{- end -}}
{{- with $image -}}
<div class="featured-image-preview">
<a href="{{ $.RelPermalink }}" aria-label="{{ $.Title }}">
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
</a>
</div>
{{- end -}}
{{- /* Title */ -}}
<h1 class="single-title" itemprop="name headline">
{{ $repost := $params.repost | default dict }}
{{- with $repost -}}
{{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share fa-fw" -}}
{{- $title := cond (hasPrefix .Url "http") (printf "%v -> %v" (T "single.repost") .Url ) (T "single.repost") -}}
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
{{- end -}}
{{- end -}}
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h1>
{{- /* Meta */ -}}
<div class="post-meta">
{{- partial "single/post-author.html" . -}}
{{- with .Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format -}}
&nbsp;<span class="post-publish" title='{{ "2006-01-02 15:04:05" | $.PublishDate.Format }}'>
{{- printf `<time datetime="%v">%v</time>` . . | dict "Date" | T "single.publishedOnDate" | safeHTML -}}
</span>
{{- end -}}
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (printf `<a href="%v">%v %v</a>` (partial "function/escapeurl.html" $category.RelPermalink) (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&ensp;" -}}
&nbsp;<span class="post-category">
{{- dict "Categories" . | T "single.includedInCategories" | safeHTML -}}
</span>
{{- end -}}
</div>
{{- /* Summary content */ -}}
<div class="content">
{{- with .Summary -}}
{{- dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- else -}}
{{- .Description | safeHTML -}}
{{- end -}}
</div>
{{- /* Footer */ -}}
<div class="post-footer">
<a href="{{ .RelPermalink }}">{{ T "single.readMore" }}</a>
{{- with .Params.tags -}}
<div class="post-tags">
{{- dict "Class" "fa-solid fa-tags fa-fw me-1" | partial "plugin/icon.html" -}}
{{- range $value := . -}}
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
{{- with $tag -}}
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .Title }}</a>
{{- end -}}
{{- end -}}
</div>
{{- end -}}
</div>
</article>

View File

@ -0,0 +1,44 @@
{{- define "title" -}}
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}
<div class="page archive">
{{- /* Title */ -}}
<h2 class="single-title animate__animated animate__pulse animate__faster">
{{- $taxonomy := .Data.Singular -}}
{{- $pageCount := len .Pages -}}
{{- if eq $taxonomy "category" -}}
{{ dict "Class" "fa-regular fa-folder-open fa-fw" | partial "plugin/icon.html" }}
{{ .Title }}&nbsp;<sup>{{- $pageCount -}}</sup>
{{- else if eq $taxonomy "tag" -}}
{{ dict "Class" "fa-solid fa-tag fa-fw" | partial "plugin/icon.html" }}
{{ .Title }}&nbsp;<sup>{{- $pageCount -}}</sup>
{{- else -}}
{{- printf "%v - %v" (T $taxonomy | default $taxonomy) .Title -}}
{{- end -}}
</h2>
{{- /* Paginate */ -}}
{{- if .Pages -}}
{{- $pages := .Pages.GroupByDate "2006" -}}
{{- with .Site.Params.list.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}}
{{- else -}}
{{- $pages = .Paginate $pages -}}
{{- end -}}
{{- range $pages.PageGroups -}}
<h3 class="group-title">{{ .Key }}</h3>
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<span class="archive-item-date" title={{ "2006-01-02 15:04:05" | .Date.Format }}>
{{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}}
</span>
</article>
{{- end -}}
{{- end -}}
{{- partial "paginator.html" . -}}
{{- end -}}
</div>
{{- end -}}

View File

@ -0,0 +1,38 @@
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}
<article class="page single special friends">
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__pulse animate__faster">{{- .Title -}}</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . }}</p>{{- end -}}
</div>
{{- /* Friend links */ -}}
<script src="//at.alicdn.com/t/font_578712_g26jo2kbzd5qm2t9.js" async defer></script>
<div class="friend-links">
{{ range $index, $friend := .Site.Data.friends }}
<a class="friend-link" title="{{ $friend.description }}" href="{{ $friend.url | safeURL }}" rel="external noopener noreferrer" target="_blank">
{{ if $friend.avatar }}
{{- dict "Src" $friend.avatar "Alt" $friend.nickname "Class" "friend-avatar" "Resources" $.Resources | partial "plugin/image.html" -}}
{{ else }}
<svg class="friend-avatar" aria-hidden="true">
<use xlink:href="#icon-{{ add 1 $index }}"></use>
</svg>
{{ end }}
<span class="friend-nickname" title="{{ $friend.nickname }}">@{{ $friend.nickname }}</span>
</a>
{{ end }}
</div>
{{- /* Content */ -}}
<div class="content" id="content">
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
</div>
{{- /* Comment */ -}}
{{- partial "single/comment.html" . -}}
</article>
{{- end -}}

View File

@ -0,0 +1,41 @@
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}
{{- $profile := .Site.Params.home.profile -}}
{{- $posts := .Site.Params.home.posts -}}
<div class="page home{{ if ne $posts.enable false }} posts{{ end }}">
{{- /* Profile */ -}}
{{- if ne $profile.enable false -}}
{{- partial "home/profile.html" . -}}
{{- end -}}
{{- /* Content */ -}}
{{- if .Content -}}
<div class="single">
<div class="content" id="content">
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
</div>
</div>
{{- end -}}
{{- /* Posts */ -}}
{{- if ne $posts.enable false | and .Site.RegularPages -}}
{{- /* Paginate */ -}}
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
{{- if .Site.Params.page.hiddenFromHomePage -}}
{{- $pages = where $pages "Params.hiddenfromhomepage" false -}}
{{- else -}}
{{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}}
{{- end -}}
{{- with $posts.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}}
{{- else -}}
{{- $pages = .Paginate $pages -}}
{{- end -}}
{{- range $pages.Pages -}}
{{- .Render "summary" -}}
{{- end -}}
{{- partial "paginator.html" . -}}
{{- end -}}
</div>
{{- end -}}

View File

@ -0,0 +1,46 @@
{{- if .Site.Params.search -}}
{{- $index := slice -}}
{{- $pages := where .Site.RegularPages "Params.password" "eq" nil -}}
{{- if .Site.Params.page.hiddenFromSearch -}}
{{- $pages = where $pages "Params.hiddenfromsearch" false -}}
{{- else -}}
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
{{- end -}}
{{- range $pages -}}
{{- $uri := .RelPermalink -}}
{{- if $.Site.Params.search.absoluteURL -}}
{{- $uri = .Permalink -}}
{{- end -}}
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories -}}
{{- $meta = $.Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format | dict "date" | merge $meta -}}
{{- with .Description -}}
{{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}}
{{- end -}}
{{- $params := .Params | merge $.Site.Params.page -}}
{{/* Extended Markdown syntax */}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{/* Remove line number for code */}}
{{- $content = $content | replaceRE `<span class="lnt?"> *\d*\n?</span>` "" -}}
{{- range $i, $contenti := split $content "<h2 id=" -}}
{{- if gt $i 0 -}}
{{- $contenti = printf "<h2 id=%v" $contenti -}}
{{- end -}}
{{- range $j, $contentj := split $contenti "<h3 id=" -}}
{{- if gt $j 0 -}}
{{- $contentj = printf "<h3 id=%v" $contentj -}}
{{- end -}}
{{/* Plainify, unescape and remove (\n, \t) */}}
{{- $contentj = $contentj | plainify | htmlUnescape | replaceRE `[\n\t ]+` " " -}}
{{- if gt $.Site.Params.search.contentLength 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}}
{{- end -}}
{{- if $contentj | and (ne $contentj " ") -}}
{{- $one := printf "%v:%v:%v" $uri $i $j | dict "content" $contentj "objectID" | merge $meta -}}
{{- $index = $index | append $one -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $index | jsonify | safeJS -}}
{{- end -}}

View File

@ -0,0 +1,43 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>
{{- .Site.Title -}}
</title>
<link>
{{- .Permalink -}}
</link>
<description>
{{- .Site.Params.description | default .Site.Title -}}
</description>
<generator>Hugo -- gohugo.io</generator>
{{- with .Site.LanguageCode -}}
<language>
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
<copyright>
{{- . -}}
</copyright>
{{- end -}}
{{- if not .Date.IsZero -}}
<lastBuildDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</lastBuildDate>
{{- end -}}
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>

View File

@ -0,0 +1,3 @@
{{- range (where .Site.Pages "Kind" "page") -}}
{{- println .Permalink -}}
{{- end -}}

View File

@ -0,0 +1,19 @@
{{- define "title" -}}
{{- T "offlineTitle" }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}
<article class="page" id="content-offline">
<div class="header">
<h1 class="offline-title animate__animated animate__pulse animate__faster">{{- T "offlineTitle" -}}</h1>
<p class="offline-subtitle animate__animated animate__headShake">
<i class="fa-stack fa-xs" aria-hidden="true">
<i class="fa-solid fa-wifi fa-stack-1x" aria-hidden="true"></i>
<i class="fa-solid fa-ban fa-stack-2x" aria-hidden="true"></i>
</i>
<span>ERROR_INTERNET_DISCONNECTED</span>
</p>
</div>
<p class="error-text">{{- T "offlineText" -}}</p>
</article>
{{- end -}}

View File

@ -0,0 +1,315 @@
{{- $params := .Scratch.Get "params" -}}
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
{{- $config := (.Scratch.Get "this").config -}}
{{- /* Search */ -}}
{{- if .Site.Params.search | and .Site.Params.search.enable -}}
{{- $search := .Site.Params.search -}}
{{- /* TODO update "lib/autocomplete-js/umd/index.production.js" */ -}}
{{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "assets.noResultsFound") | dict "search" | merge $config -}}
{{- if eq $search.type "lunr" -}}
{{- with .Site.Home.OutputFormats.Get "json" -}}
{{- $config = dict "type" "lunr" "lunrIndexURL" .RelPermalink | dict "search" | merge $config -}}
{{- end -}}
{{- $source := $cdn.lunrJS | default "lib/lunr/lunr.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- if T "assets.lunrLanguageLib" -}}
{{- $config = T "assets.lunrLanguageCode" | dict "lunrLanguageCode" | dict "search" | merge $config -}}
{{- with T "assets.lunrSegmentitLib" -}}
{{- $config = dict "lunrSegmentitURL" (resources.Get .).RelPermalink | dict "search" | merge $config -}}
{{- end -}}
{{- dict "Source" "lib/lunr/lunr.stemmer.support.js" "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- dict "Source" (T "assets.lunrLanguageLib") "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- else if eq $search.type "algolia" -}}
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
{{- else if eq $search.type "fuse" -}}
{{- with .Site.Home.OutputFormats.Get "json" -}}
{{- $config = dict "type" "fuse" "fuseIndexURL" .RelPermalink | dict "search" | merge $config -}}
{{- end -}}
{{- $source := $cdn.fuseJS | default "lib/fuse/fuse.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "isCaseSensitive" $search.fuse.isCaseSensitive "minMatchCharLength" $search.fuse.minMatchCharLength "findAllMatches" $search.fuse.findAllMatches "location" $search.fuse.location "threshold" $search.fuse.threshold "distance" $search.fuse.distance "ignoreLocation" $search.fuse.ignoreLocation "useExtendedSearch" $search.fuse.useExtendedSearch "ignoreFieldNorm" $search.fuse.ignoreFieldNorm | dict "search" | merge $config -}}
{{- end -}}
{{- end -}}
{{- /* instant.page */ -}}
{{- if $params.instantPage -}}
{{- $source := $cdn.instantPage | default "lib/instant-page/instantpage.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- /* twemoji */ -}}
{{- if $params.twemoji -}}
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "twemoji" true | merge $config -}}
{{- end -}}
{{- /* lightgallery */ -}}
{{- if $params.lightgallery | or (eq $params.lightgallery "force") -}}
{{- $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 "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/plugins/thumbnail/lg-thumbnail.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/plugins/zoom/lg-zoom.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "lightgallery" true | merge $config -}}
{{- end -}}
{{- $code := $params.code | default dict -}}
{{- $config = cond (ne $code.maxShownLines nil) $code.maxShownLines 10 | dict "maxShownLines" | dict "code" | merge $config -}}
{{- /* edit code */ -}}
{{- if ne $code.edit false -}}
{{- $config = dict "editable" true "editLockTitle" (T "assets.editLockTitle") "editUnLockTitle" (T "assets.editUnLockTitle") | dict "code" | merge $config -}}
{{- end -}}
{{- /* copy code */ -}}
{{- if ne $code.copy false -}}
{{- $config = T "assets.copyToClipboard" | dict "copyTitle" | dict "code" | merge $config -}}
{{- end -}}
{{- /* Sharer.js */ -}}
{{- if $params.share.enable -}}
{{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- /* TypeIt */ -}}
{{- with (.Scratch.Get "this").typeitMap -}}
{{- $typeit := $.Site.Params.typeit -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "loop" $typeit.loop "data" . | dict "typeit" | merge $config -}}
{{- end -}}
{{- /* KaTeX */ -}}
{{- $math := .Scratch.Get "math" -}}
{{- if $math.enable -}}
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
{{- 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 "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- if $math.copyTex -}}
{{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- if $math.mhchem -}}
{{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{equation}" "right" "\\end{equation}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{equation*}" "right" "\\end{equation*}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{align}" "right" "\\end{align}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{align*}" "right" "\\end{align*}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{alignat}" "right" "\\end{alignat}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{alignat*}" "right" "\\end{alignat*}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{gather}" "right" "\\end{gather}" "display" true) -}}
{{- $delimiters = $delimiters | append (dict "left" "\\begin{CD}" "right" "\\end{CD}" "display" true) -}}
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
{{- $delimiters = $delimiters | append (dict "left" $math.blockLeftDelimiter "right" $math.blockRightDelimiter "display" true) -}}
{{- end -}}
{{- $delimiters = $delimiters | append (dict "left" "$" "right" "$" "display" false) (dict "left" "\\(" "right" "\\)" "display" false) -}}
{{- if and $math.inlineLeftDelimiter $math.inlineRightDelimiter -}}
{{- $delimiters = $delimiters | append (dict "left" $math.inlineRightDelimiter "right" $math.inlineRightDelimiter "display" false) -}}
{{- end -}}
{{- $config = dict "strict" false "delimiters" $delimiters | dict "math" | merge $config -}}
{{- end -}}
{{- /* mermaid */ -}}
{{- if (.Scratch.Get "this").mermaid -}}
{{- $source := $cdn.mermaidJS | default "lib/mermaid/mermaid.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $mermaid := .Site.Params.mermaid -}}
{{- $config = dict "themes" $mermaid.themes | dict "mermaid" | merge $config -}}
{{- end -}}
{{- /* ECharts */ -}}
{{- if (.Scratch.Get "this").echarts -}}
{{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | 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 */ -}}
{{- if (.Scratch.Get "this").mapbox -}}
{{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.css" -}}
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source = $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}}
{{- end -}}
{{- /* Music */ -}}
{{- if (.Scratch.Get "this").music -}}
{{- /* APlayer */ -}}
{{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}}
{{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- /* MetingJS */ -}}
{{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- /* Cookie Consent */ -}}
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
{{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}}
{{- $cookieconsentConfig = .Site.Params.cookieconsent | merge $cookieconsentConfig -}}
{{- $cookieconsentConfig = dict "message" ($cookieconsentConfig.content.message | default (T "assets.cookieconsentMessage")) "dismiss" ($cookieconsentConfig.content.dismiss | default (T "assets.cookieconsentDismiss")) "link" ($cookieconsentConfig.content.link | default (T "assets.cookieconsentLink")) | dict "content" | merge $cookieconsentConfig -}}
{{- $config = $cookieconsentConfig | dict "cookieconsent" | merge $config -}}
{{- end -}}
{{- /* PanguJS */ -}}
{{- if eq .Site.Params.pangu.enable true -}}
{{- $source := $cdn.panguJS | default "lib/pangu/pangu.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "pangu" .Site.Params.pangu | merge $config -}}
{{- end -}}
{{- /* Watermark */ -}}
{{- if eq .Site.Params.watermark.enable true -}}
{{- $source := $cdn.cellWatermarkJS | default "lib/cell-watermark/watermark.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- /* Hugo bug: case insensitive for `.Site.Params` */ -}}
{{- $config = dict "watermark" .Site.Params.watermark | merge $config -}}
{{- end -}}
{{- /* Content Decryption */ -}}
{{- $encryptPartial := (.Scratch.Get "this").encryptPartial -}}
{{- if $params.password | or $encryptPartial -}}
{{- $cryptoCoreJS := $cdn.cryptoCoreJS | default "lib/crypto-js/core.js" -}}
{{- $cryptoEncBase64JS := $cdn.cryptoEncBase64JS | default "lib/crypto-js/enc-base64.js" -}}
{{- $cryptoMd5JS := $cdn.cryptoMd5JS | default "lib/crypto-js/md5.js" -}}
{{- $cryptoSha256JS := $cdn.cryptoSha256JS | default "lib/crypto-js/sha256.js" -}}
{{- dict "Source" $cryptoCoreJS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- dict "Source" $cryptoEncBase64JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- dict "Source" $cryptoMd5JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- dict "Source" $cryptoSha256JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- dict "Source" "js/fixit-decryptor.js" "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "all" (isset $params "password") "shortcode" ($encryptPartial | default false) | dict "encryption" | merge $config -}}
{{- end -}}
{{- /* Mobile Devtools */ -}}
{{- $mDevtools := (.Scratch.Get "devOpts").mDevtools -}}
{{- if $mDevtools.enable -}}
{{- $devtoolsJS := $cdn.vconsoleJS | default "lib/vconsole/vconsole.min.js" -}}
{{- if eq $mDevtools.type "eruda" -}}
{{- $devtoolsJS = $cdn.erudaJS | default "lib/eruda/eruda.js" -}}
{{- end -}}
{{- dict "Source" $devtoolsJS "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "mDevtools" ($mDevtools.type | default "vConsole") | merge $config -}}
{{- end -}}
{{- /* 不蒜子 */ -}}
{{- if eq .Site.Params.ibruce.enable true -}}
{{- $source := "//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- /* Site creation time */ -}}
{{- $siteTime := .Scratch.Get "siteTime" -}}
{{- if $siteTime.enable -}}
{{- with $siteTime.value -}}
{{- $config = dict "siteTime" . | merge $config -}}
{{- end -}}
{{- end -}}
{{- /* PWA */ -}}
{{- if .Site.Params.enablePWA | and hugo.IsProduction -}}
{{- $options := dict "targetPath" "service-worker.min.js" "minify" true -}}
{{- $source := resources.Get "js/service-worker.js" | js.Build $options -}}
{{- $_ := $source.RelPermalink -}}
{{- $config = dict "enablePWA" .Site.Params.enablePWA | merge $config -}}
{{- end -}}
{{- /* Auto Bookmark */ -}}
{{- if eq .Kind "page" -}}
{{- with $params.autoBookmark -}}
{{- $config = dict "autoBookmark" . | merge $config -}}
{{- end -}}
{{- end -}}
{{- /* PACE */ -}}
{{- if eq .Site.Params.pace.enable true -}}
{{- $paceJS := "" -}}
{{- $paceCSS := "" -}}
{{- with ($cdn.paceJS | default "lib/pace") -}}
{{- $paceJS = printf "%v/pace.min.js" . -}}
{{- if $.Site.Params.pace.color | and $.Site.Params.pace.theme -}}
{{- $paceCSS = printf "%v/themes/%v/pace-theme-%v.css" . $.Site.Params.pace.color $.Site.Params.pace.theme -}}
{{- else -}}
{{- $paceCSS = printf "%v/pace-theme-default.min.css" . -}}
{{- end -}}
{{- end -}}
{{- dict "Source" $paceJS "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- dict "Source" $paceCSS "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- /* To patch pace theme flat-top z-index error */ -}}
{{- if eq $.Site.Params.pace.theme "flat-top" -}}
{{- dict "Source" "lib/pace/pace-patch-flat-top.css" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- end -}}
{{- end -}}
{{- range $params.library.css -}}
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
{{- end -}}
{{- range $params.library.js -}}
{{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- with (.Scratch.Get "this").styleArr -}}
{{- $content := delimit . "" -}}
{{- $path := substr (md5 $content) 0 6 | printf "css/%v" -}}
{{- $options := printf "%v.min.css" $path | dict "targetPath" -}}
{{- dict "Content" $content "Path" (printf "%v.scss" $path) "ToCSS" $options | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
{{- end -}}
{{- /* Config script */ -}}
{{- $config | jsonify | printf "window.config=%s;" | dict "Content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- /* Theme script */ -}}
{{- /* TODO migrate to js.build in hugo future version */ -}}
{{- dict "Source" "js/theme.min.js" "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
{{- /* Custom script */ -}}
{{- with ((resources.Get "js/custom.js") | default (resources.Get "js/_custom.js")) -}}
{{- $options := dict "targetPath" "js/custom.min.js" "minify" true "sourceMap" "inline" -}}
{{- dict "Source" . "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- with (.Scratch.Get "this").scriptArr -}}
{{- delimit . "\n" | dict "Content" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- range (.Scratch.Get "this").style -}}
{{- partial "plugin/style.html" . -}}
{{- end -}}
{{- range (.Scratch.Get "this").script -}}
{{- partial "plugin/script.html" . -}}
{{- end -}}
{{- partial "plugin/analytics.html" . -}}

View File

@ -0,0 +1,12 @@
{{- if (gt (len .Ancestors.Reverse) 1) | and (eq .Site.Params.breadcrumb.enable true) -}}
<nav aria-label="breadcrumb" class="breadcrumb-container{{ if .Site.Params.breadcrumb.sticky }} sticky{{ end }}">
<ol class="breadcrumb">
{{- range .Ancestors.Reverse -}}
{{- if or .Site.Params.breadcrumb.showHome (not .IsHome) -}}
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}" title="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage | and .Summary }}{{ .Summary }}{{ else }}{{ .Title }}{{ end }}{{ end }}">{{ cond (and .Site.Params.breadcrumb.showHome .IsHome) (T "single.home") .Title }}</a></li>
{{- end -}}
{{- end -}}
<li class="breadcrumb-item active" aria-current="page">{{ .Title }}</li>
</ol>
</nav>
{{- end -}}

View File

@ -0,0 +1 @@
{{- /* Custom aside html */ -}}

View File

@ -0,0 +1,6 @@
{{- /* Custom footer html */ -}}
{{- with .Site.Params.footer.custom -}}
<div class="footer-line custom">
{{- safeHTML . -}}
</div>
{{- end -}}

View File

@ -0,0 +1 @@
{{- /* Custom profile html at home page */ -}}

View File

@ -0,0 +1,92 @@
{{- if ne .Site.Params.footer.enable false -}}
<footer class="footer">
<div class="footer-container">
{{- /* Custom Content */ -}}
{{- partial (.Scratch.Get "customFilePath").footer . -}}
{{- /* Hugo and FixIt */ -}}
{{- if ne .Site.Params.footer.hugo false -}}
<div class="footer-line powered{{ with .Site.Params.footer.order.powered }} order-{{ . }}{{ end }}">
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreferrer" title="Hugo %v">Hugo</a>` hugo.Version -}}
{{- $theme := printf `<a href="https://github.com/hugo-fixit/FixIt" target="_blank" rel="external" title="FixIt %v"><img class="fixit-icon" src="%v" alt="FixIt logo" />&nbsp;FixIt</a>`
(.Scratch.Get "version")
(resources.Get "fixit.svg" | minify).RelPermalink
-}}
{{- dict "Hugo" $hugo "Theme" $theme | T "footer.poweredBySome" | safeHTML }}
</div>
{{- end -}}
{{- if .Site.Params.footer.copyright | or .Site.Params.footer.author | or .Site.Params.footer.license -}}
<div class="footer-line copyright{{ with .Site.Params.footer.order.copyright }} order-{{ . }}{{ end }}" itemscope itemtype="http://schema.org/CreativeWork">
{{- /* Copyright year */ -}}
{{- if ne .Site.Params.footer.copyright false -}}
{{ dict "Class" "fa-regular fa-copyright fa-fw" | partial "plugin/icon.html" }}
{{ with .Site.Params.footer.since -}}
<span itemprop="copyrightYear">
{{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}}
</span>
{{- else -}}
<span itemprop="copyrightYear">{{ now.Year }}</span>
{{- end -}}
{{- end -}}
{{- /* Author */ -}}
{{- if ne .Site.Params.footer.author false -}}
<span class="author" itemprop="copyrightHolder">
{{ partial "plugin/link.html" (dict "Destination" ($.Site.Author.link | default .Site.Home.RelPermalink) "Content" .Site.Author.name) -}}
</span>
{{- end -}}
{{- /* License */ -}}
{{- with .Site.Params.footer.license -}}
<span class="license footer-divider">{{ . | safeHTML }}</span>
{{- end -}}
</div>
{{- end -}}
{{- $siteTime := .Scratch.Get "siteTime" -}}
{{- if $siteTime.enable | or .Site.Params.footer.wordCount -}}
<div class="footer-line statistics{{ with .Site.Params.footer.order.statistics }} order-{{ . }}{{ end }}">
{{- if $siteTime.enable | and $siteTime.value -}}
{{- with $siteTime -}}
<span class="site-time" title='{{ T "footer.siteRunning" }}'>
{{- $siteTimeIcon := printf (cond .Animate "%v fa-fw animate-icon" "%v fa-fw") .Icon -}}
{{- dict "Class" $siteTimeIcon | partial "plugin/icon.html" -}}
{{- with .Pre -}}<span class="ms-1 d-none">{{ . }}</span>{{- end -}}
{{- printf `<span class="run-times ms-1">%v</span>` (T "footer.siteRunning") | safeHTML -}}
</span>
{{- end -}}
{{- end -}}
</div>
{{- end -}}
{{- /* 不蒜子 */ -}}
{{- if eq .Site.Params.ibruce.enable true -}}
{{- $loading := dict "Class" "fa-solid fa-spinner fa-spin fa-fw" | partial "plugin/icon.html" -}}
<div class="footer-line visitor{{ with .Site.Params.footer.order.visitor }} order-{{ . }}{{ end }}">
<span id="busuanzi_container_site_uv" title='{{ T "footer.siteUV" }}'>
{{- dict "Class" "fa-regular fa-user fa-fw" | partial "plugin/icon.html" -}}&nbsp;<span id="busuanzi_value_site_uv">{{ $loading }}</span>{{- /* NO_SPACING */ -}}
</span>
{{- /* NO_SPACING */ -}}
<span id="busuanzi_container_site_pv" class="footer-divider" title='{{ T "footer.sitePV" }}'>
{{- dict "Class" "fa-regular fa-eye fa-fw" | partial "plugin/icon.html" -}}&nbsp;<span id="busuanzi_value_site_pv">{{ $loading }}</span>{{- /* NO_SPACING */ -}}
</span>
</div>
{{- end -}}
{{- if .Site.Params.footer.gov | or .Site.Params.footer.icp -}}
<div class="footer-line beian{{ with .Site.Params.footer.order.beian }} order-{{ . }}{{ end }}">
{{- /* GOV */ -}}
{{- with .Site.Params.footer.gov -}}
<span class="gov">{{ . | safeHTML }}</span>
{{- end -}}
{{- /* ICP */ -}}
{{- with .Site.Params.footer.icp -}}
<span class="icp footer-divider">{{ . | safeHTML }}</span>
{{- end -}}
</div>
{{- end -}}
</div>
</footer>
{{- end -}}

View File

@ -0,0 +1,9 @@
{{- /* Checkbox unchecked */ -}}
{{- $old := `<input disabled="" type="checkbox">` -}}
{{- $new := dict "Class" "fa-regular fa-square fa-fw" | partial "plugin/icon.html" -}}
{{- $content := replace . $old $new -}}
{{- /* Checkbox checked */ -}}
{{- $old = `<input checked="" disabled="" type="checkbox">` -}}
{{- $new := dict "Class" "fa-regular fa-check-square fa-fw" | partial "plugin/icon.html" -}}
{{- return replace $content $old $new -}}

View File

@ -0,0 +1,23 @@
{{- $content := .Content -}}
{{- if $content -}}
{{- if .Ruby -}}
{{- $content = partial "function/ruby.html" $content -}}
{{- end -}}
{{- if .Fraction -}}
{{- $content = partial "function/fraction.html" $content -}}
{{- end -}}
{{- if .Fontawesome -}}
{{- $content = partial "function/fontawesome.html" $content -}}
{{- end -}}
{{- $content = partial "function/checkbox.html" $content -}}
{{- $content = partial "function/escape.html" $content -}}
{{- end -}}
{{- return $content -}}

View File

@ -0,0 +1,4 @@
{{- /* Unify new lines symbol */ -}}
{{- /* See https://en.wikipedia.org/wiki/Newline */ -}}
{{- return replace . "\r\n" "\n" -}}

View File

@ -0,0 +1,5 @@
{{- /* Escape character */ -}}
{{- /* {?X} -> X */ -}}
{{- $REin := `\{\?(.)\}` -}}
{{- $REout := `$1` -}}
{{- return replaceRE $REin $REout . -}}

View File

@ -0,0 +1,6 @@
{{- /* Escape url special characters to query format, e.g: `#` -> `%23` */ -}}
{{- /* https://github.com/hugo-fixit/FixIt/issues/245 */ -}}
{{- $content := . -}}
{{- $content = replace $content "#" "%23" -}}
{{- return $content -}}

View File

@ -0,0 +1,14 @@
{{- /* Font Awesome */ -}}
{{- /* :(fa-regular fa-circle): -> <i class="fa-regular fa-circle" aria-hidden="true"></i> */ -}}
{{- $REin := ` (:\([\w- ]+?\):)` -}}
{{- $REout := `&nbsp;$1` -}}
{{- $content := replaceRE $REin $REout . -}}
{{- $REin = `(:\([\w- ]+?\):) ` -}}
{{- $REout = `$1&nbsp;` -}}
{{- $content = replaceRE $REin $REout . -}}
{{- $REin = `:\(([\w- ]+?)\):` -}}
{{- $REout = `<i class="$1" aria-hidden="true"></i>` -}}
{{- return replaceRE $REin $REout $content -}}

View File

@ -0,0 +1,5 @@
{{- /* Fraction */ -}}
{{- /* [A]/[B] -> <sup>A</sup>/<sub>B</sub> */ -}}
{{- $REin := `\[(.+?)\]/\[(.+?)\]` -}}
{{- $REout := `<sup>$1</sup>/<sub>$2</sub>` -}}
{{- return replaceRE $REin $REout . -}}

View File

@ -0,0 +1,14 @@
{{- /* ID */ -}}
{{- $id := "" -}}
{{- with .Id -}}
{{- /* If an ID is specified, then just use it.*/ -}}
{{- $id = printf "%v" . -}}
{{- else -}}
{{- $count := ($.Scratch.Get "this").count | default 1 -}}
{{- $id = printf "id-%d" $count -}}
{{- $count | add 1 | $.Scratch.SetInMap "this" "count" -}}
{{- end -}}
{{- with .Content -}}
{{- dict $id . | dict "data" | dict "config" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- end -}}
{{- return $id -}}

View File

@ -0,0 +1,4 @@
{{- /* https://discourse.gohugo.io/t/how-decode-urls-in-hugo/7549/4 */ -}}
{{- $URL := partial "function/escapeurl.html" . -}}
{{- $URL = $URL | urlize | urls.Parse -}}
{{- return $URL.Path -}}

View File

@ -0,0 +1,16 @@
{{- $resource := 0 -}}
{{- $url := urls.Parse .Path -}}
{{- if not $url.Host | and $url.Path | and (strings.HasSuffix $url.Path "/" | not) -}}
{{- if .Resources -}}
{{- with .Resources.GetMatch $url.Path -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}
{{- if not $resource -}}
{{- with resources.Get $url.Path -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $resource -}}

View File

@ -0,0 +1,5 @@
{{- /* Ruby */ -}}
{{- /* [EN]^(English) -> <strong><ruby>EN<rt>English</rt></ruby></strong> */ -}}
{{- $REin := `\[(.+?)\]\^\((.+?)\)` -}}
{{- $REout := `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
{{- return replaceRE $REin $REout . -}}

View File

@ -0,0 +1,48 @@
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
{{- if not .Site.Params.app.noFavicon -}}
{{- with .Site.Params.app.svgFavicon -}}
<link rel="icon" href="{{ . }}">
{{- else -}}
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
{{- end -}}
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
{{- with .Site.Params.app.iconColor -}}
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="{{ . }}">
{{- end -}}
{{- if eq .Site.Params.enablePWA true -}}
<link rel="manifest" href="/site.webmanifest">
{{- end -}}
{{- end -}}
<link rel="canonical" href="{{ .Permalink }}" />
{{- if .PrevInSection -}}
<link rel="prev" href="{{ .PrevInSection.Permalink }}" />
{{- end -}}
{{- if .NextInSection -}}
<link rel="next" href="{{ .NextInSection.Permalink }}" />
{{- end -}}
{{- with .OutputFormats.Get "RSS" -}}
<link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
<link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
{{- end -}}
{{- /* 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 -}}
{{- /* Font Awesome */ -}}
{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}}
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
{{- partial "plugin/style.html" $style -}}
{{- /* Animate.css */ -}}
{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}}
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
{{- partial "plugin/style.html" $style -}}

View File

@ -0,0 +1,56 @@
{{- $params := .Scratch.Get "params" -}}
<meta name="author" content="{{ .Site.Author.name }}">
<meta name="author-link" content="{{ .Site.Author.link }}">
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage | and .Summary }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
{{- $keywords := .Keywords -}}
{{- if not $keywords -}}
{{- if .IsPage | and .Params.tags -}}
{{- $keywords = .Params.tags -}}
{{- else -}}
{{- $keywords = .Site.Params.keywords -}}
{{- end -}}
{{- end -}}
{{- with $keywords -}}
<meta name="keywords" content='{{ delimit . ", " }}' />
{{- end -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
<meta name="application-name" content="{{ .Site.Params.app.title | default .Site.Title }}">
<meta name="apple-mobile-web-app-title" content="{{ .Site.Params.app.title | default .Site.Title }}">
{{- with .Site.Params.app.themeColor -}}
{{- $color := . -}}
{{- if ne (len $color) 2 -}}
{{- $color = dict "light" . "dark" . -}}
{{- end -}}
<meta name="theme-color" data-light="{{ $color.light }}" data-dark="{{ $color.dark }}" content="{{ $color.light }}">
{{- end -}}
{{- with .Site.Params.app.tileColor -}}
<meta name="msapplication-TileColor" content="{{ . }}">
{{- end -}}
<script type="text/javascript">
/** This section is only needed once per page if manually copying **/
if (typeof MauticSDKLoaded == 'undefined') {
var MauticSDKLoaded = true;
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://ma.m3tam3re.com/media/js/mautic-form.js?vfad3b6d1';
script.onload = function() {
MauticSDK.onLoad();
};
head.appendChild(script);
var MauticDomain = 'https://ma.m3tam3re.com';
var MauticLang = {
'submittingMessage': "Please wait..."
}
}else if (typeof MauticSDK != 'undefined') {
MauticSDK.onLoad();
}
</script>

View File

@ -0,0 +1,167 @@
{{- $params := .Scratch.Get "params" -}}
{{- 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.yandex -}}
<meta name="yandex-verification" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.verification.pinterest -}}
<meta name="p:domain_verify" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.verification.baidu -}}
<meta name="baidu-site-verification" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.verification.so -}}
<meta name="360-site-verification" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.verification.sogou -}}
<meta name="sogou_site_verification" content="{{ . }}" />
{{- end -}}
{{- /* Home SEO */ -}}
{{- if .IsHome -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "{{ .Permalink }}",
{{- with .Site.LanguageCode -}}
"inLanguage": "{{ . }}",
{{- end -}}
{{- with .Site.Author.name -}}
"author": {
"@type": "Person",
"name": {{ . | safeHTML }}
},
{{- end -}}
{{- with .Site.Params.description -}}
"description": {{ . | safeHTML }},
{{- end -}}
{{- $image := .Site.Params.seo.image -}}
{{- with dict "Path" $image "Resources" .Resources | partial "function/resource.html" -}}
"image": {
"@type": "ImageObject",
"url": "{{ .Permalink }}",
"width": {{ .Width }},
"height": {{ .Height }}
},
{{- else -}}
{{- with $image -}}
"image": "{{ . | absURL }}",
{{- end -}}
{{- end -}}
{{- with .Site.Params.seo.thumbnailUrl -}}
{{- with dict "Path" . "Resources" $.Resources | partial "function/resource.html" -}}
"thumbnailUrl": "{{ .Permalink }}",
{{- else -}}
"thumbnailUrl": "{{ . | absURL }}",
{{- end -}}
{{- end -}}
{{- with .Site.Copyright -}}
"license": "{{ . | safeHTML }}",
{{- end -}}
"name": {{ .Site.Title | safeHTML }}
}
</script>
{{- /* Page SEO */ -}}
{{- else if .IsPage -}}
{{- $authorName := .Site.Author.name | default (T "single.author") -}}
{{- with .Params.author -}}
{{- if reflect.IsMap . -}}
{{- $authorName = cond (isset . "name") .name $authorName -}}
{{- else -}}
{{- $authorName = . -}}
{{- end -}}
{{- end -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": {{ .Title | safeHTML }},
"inLanguage": "{{ .Site.LanguageCode }}",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "{{ .Permalink }}"
},
{{- $images := $params.seo.images | default slice -}}
{{- if not $images -}}
{{- with .Resources.GetMatch "featured-image-preview" -}}
{{- $images = slice "featured-image-preview" -}}
{{- end -}}
{{- with .Resources.GetMatch "featured-image" -}}
{{- $images = slice "featured-image" -}}
{{- end -}}
{{- end -}}
{{- with .Site.Params.seo.image -}}
{{- $images = $images | default (slice .) -}}
{{- end -}}
{{- with $images -}}
"image": [
{{- range $index, $value := . -}}
{{- if gt $index 0 }},{{ end -}}
{{- with dict "Path" $value "Resources" $.Resources | partial "function/resource.html" -}}
{
"@type": "ImageObject",
"url": "{{ .Permalink }}",
"width": {{ .Width }},
"height": {{ .Height }}
}
{{- else -}}
{{- with $value -}}
"{{ . | absURL }}"
{{- end -}}
{{- end -}}
{{- end -}}
],
{{- end -}}
"genre": "{{ .Type }}",
{{- with .Params.tags -}}
"keywords": "{{ delimit . ", " }}",
{{- end -}}
"wordcount": {{ .WordCount }},
"url": "{{ .Permalink }}",
{{- if not .PublishDate.IsZero -}}
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }},
{{- else if not .Date.IsZero -}}
"datePublished": {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }},
{{- end -}}
{{- with .Lastmod -}}
"dateModified": {{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }},
{{- end -}}
{{- with .Site.Copyright -}}
"license": {{ . | safeHTML }},
{{- end -}}
{{- $publisher := $authorName | dict "name" -}}
{{- $publisher = $params.seo.publisher | default dict | merge $publisher -}}
"publisher": {
"@type": "Organization",
"name": {{ $publisher.name | safeHTML }}
{{- $logo := $publisher.logoUrl -}}
{{- with dict "Path" $logo "Resources" .Resources | partial "function/resource.html" -}}
,"logo": {
"@type": "ImageObject",
"url": "{{ .Permalink }}",
"width": {{ .Width }},
"height": {{ .Height }}
}
{{- else -}}
{{- with $logo -}}
,"logo": "{{ . | absURL }}"
{{- end -}}
{{- end -}}
},
{{- with $authorName -}}
"author": {
"@type": "Person",
"name": {{ . | safeHTML }}
},
{{- end -}}
"description": {{ .Description | safeHTML }}
}
</script>
{{- end -}}

View File

@ -0,0 +1,321 @@
{{- $buildDrafts := .Site.BuildDrafts -}}
{{- /* Desktop header */ -}}
<header class="desktop animate__faster" id="header-desktop">
<div class="header-wrapper"{{ if .Site.Params.githubCorner.enable }} data-github-corner="{{ .Site.Params.githubCorner.position }}"{{ end }}>
<div class="header-title">
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- dict "Src" . "Class" "logo" "Alt" $.Site.Title | partial "plugin/image.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
{{- end -}}
{{- if .typeit -}}
{{- $id := dict "Content" .name "Scratch" $.Scratch "Id" "typeit-header-desktop" | partial "function/id.html" -}}
<span id="{{ $id }}" class="typeit"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
<span class="header-title-text">{{- .name -}}</span>
{{- end -}}
{{- with .post -}}
<span class="header-title-post">{{ . | safeHTML }}</span>
{{- end -}}
{{- else -}}
<span class="header-title-text">{{- .Site.Title -}}</span>
{{- end -}}
</a>
{{- with .Site.Params.header.subtitle -}}
{{- if .typeit -}}
{{- $id := dict "Content" .name "Scratch" $.Scratch "Id" "typeit-header-subtitle-desktop" | partial "function/id.html" -}}
<span id="{{ $id }}" class="typeit header-subtitle"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
<span class="header-subtitle">{{- .name -}}</span>
{{- end -}}
{{- end -}}
</div>
<nav>
<ul class="menu">
{{- range .Site.Menus.main -}}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
{{- if (ne .Params.Draft true) | or $buildDrafts | and (ne .Params.Type "mobile") -}}
<li class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}{{ if .HasChildren }} has-children{{ end }}">
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
{{- if .HasChildren -}}
{{ dict "Class" "dropdown-icon fa-solid fa-chevron-down" | partial "plugin/icon.html" }}
<ul class="sub-menu">
{{ range .Children }}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
{{- if (ne .Params.Draft true) | or $buildDrafts | and (ne .Params.Type "mobile") -}}
<li
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
>
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
</li>
{{- end -}}
{{- end -}}
</ul>
{{- end -}}
</li>
{{- end -}}
{{- end -}}
{{- if .Site.Menus.main -}}
<li class="menu-item delimiter"></li>
{{- end -}}
{{- if .Site.Params.search.enable -}}
<li class="menu-item search" id="search-desktop">
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `assets.searchPlaceholder`) }}" id="search-input-desktop">
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-desktop" title="{{ T `assets.search` }}">
{{ dict "Class" "fa-solid fa-search fa-fw" | partial "plugin/icon.html" }}
</a>
<a href="javascript:void(0);" class="search-button search-clear" id="search-clear-desktop" title="{{ T `assets.clear` }}">
{{ dict "Class" "fa-solid fa-times-circle fa-fw" | partial "plugin/icon.html" }}
</a>
<span class="search-button search-loading" id="search-loading-desktop">
{{ dict "Class" "fa-solid fa-spinner fa-fw fa-spin" | partial "plugin/icon.html" }}
</span>
</li>
{{- end -}}
<li class="menu-item theme-switch" title="{{ T "header.switchTheme" }}">
{{ dict "Class" "fa-solid fa-adjust fa-fw" | partial "plugin/icon.html" }}
</li>
{{- if .Site.IsMultiLingual -}}
<li class="menu-item language-switch">
<span role="button" aria-label="{{ T "header.selectLanguage" }}" title="{{ T "header.selectLanguage" }}">
{{- dict "Class" "fa-solid fa-language fa-fw" | partial "plugin/icon.html" -}}
</span>
<ul class="sub-menu">
{{- if (eq .Kind "404") -}}
{{- range .Sites -}}
{{- if ne . $.Site -}}
{{- $link := printf "%v/404.html" .LanguagePrefix -}}
<li class="menu-item">
<a href="{{ $link }}" class="menu-link" title="{{- .Language.LanguageName -}}">
{{- .Language.LanguageName -}}
</a>
</li>
{{- end -}}
{{- end -}}
{{- else if gt (len .AllTranslations) 1 -}}
{{- range .AllTranslations -}}
{{- if ne .Lang $.Lang -}}
<li class="menu-item">
<a href="{{ .RelPermalink }}" class="menu-link" title="{{ .Language.LanguageName }}">
{{- .Language.LanguageName -}}
</a>
</li>
{{- else -}}
<li class="menu-item">
<span class="menu-link text-secondary" title="{{ .Language.LanguageName }}">{{ .Language.LanguageName }}</span>
</li>
{{- end -}}
{{- end -}}
{{- else -}}
<li class="menu-item">{{- T "header.noMoretTranslations" -}}</li>
{{- end -}}
</ul>
</li>
{{- end -}}
</ul>
</nav>
</div>
</header>
{{- /* Mobile header */ -}}
<header class="mobile animate__faster" id="header-mobile">
<div class="header-container">
<div class="header-wrapper">
<div class="header-title">
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
{{- end -}}
{{- if .typeit -}}
{{- $id := dict "Content" .name "Scratch" $.Scratch "Id" "typeit-header-title-mobile" | partial "function/id.html" -}}
<span id="{{ $id }}" class="typeit"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
<span class="header-title-text">{{- .name -}}</span>
{{- end -}}
{{- with .post -}}
<span class="header-title-post">{{ . | safeHTML }}</span>
{{- end -}}
{{- else -}}
<span class="header-title-text">{{- .Site.Title -}}</span>
{{- end -}}
</a>
{{- with .Site.Params.header.subtitle -}}
{{- if .typeit -}}
{{- $id := dict "Content" .name "Scratch" $.Scratch "Id" "typeit-header-subtitle-mobile" | partial "function/id.html" -}}
<span id="{{ $id }}" class="typeit header-subtitle"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
<span class="header-subtitle">{{- .name -}}</span>
{{- end -}}
{{- end -}}
</div>
<div class="menu-toggle" id="menu-toggle-mobile">
<span></span><span></span><span></span>
</div>
</div>
<nav>
<ul class="menu" id="menu-mobile">
{{- if .Site.Params.search.enable -}}
<li class="search-wrapper">
<div class="search mobile" id="search-mobile">
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `assets.searchPlaceholder`) }}" id="search-input-mobile">
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-mobile" title="{{ T `assets.search` }}">
{{ dict "Class" "fa-solid fa-search fa-fw" | partial "plugin/icon.html" }}
</a>
<a href="javascript:void(0);" class="search-button search-clear" id="search-clear-mobile" title="{{ T `assets.clear` }}">
{{ dict "Class" "fa-solid fa-times-circle fa-fw" | partial "plugin/icon.html" }}
</a>
<span class="search-button search-loading" id="search-loading-mobile">
{{ dict "Class" "fa-solid fa-spinner fa-fw fa-spin" | partial "plugin/icon.html" }}
</span>
</div>
<a href="javascript:void(0);" class="search-cancel" id="search-cancel-mobile">
{{ T `assets.cancel` }}
</a>
</li>
{{- end -}}
{{- $currentPage := . -}}
{{- range .Site.Menus.main -}}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
{{- if (ne .Params.Draft true) | or $buildDrafts | and (ne .Params.Type "desktop") -}}
<li
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
>
{{- if .HasChildren -}}
<span class="nested-item">
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
{{ dict "Class" "dropdown-icon fa-solid fa-chevron-right" | partial "plugin/icon.html" }}
</span>
<ul class="sub-menu">
{{ range .Children }}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
{{- if (ne .Params.Draft true) | or $buildDrafts | and (ne .Params.Type "desktop") -}}
<li
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
>
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
</li>
{{- end -}}
{{- end -}}
</ul>
{{- else -}}
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
{{- end -}}
</li>
{{- end -}}
{{- end -}}
<li class="menu-item menu-system">
<span class="menu-system-item theme-switch" title="{{ T "header.switchTheme" }}">{{ dict "Class" "fa-solid fa-adjust fa-fw" | partial "plugin/icon.html" }}</span>
{{- if .Site.IsMultiLingual -}}
<span class="menu-system-item language-switch">
<span role="button" aria-label="{{ T "header.selectLanguage" }}" title="{{ T "header.selectLanguage" }}">
{{- .Language.LanguageName -}}
{{- dict "Class" "dropdown-icon fa-solid fa-chevron-down" | partial "plugin/icon.html" -}}
</span>
<select class="language-select" onchange="location = this.value;">
{{- if eq .Kind "404" -}}
{{- range .Sites -}}
{{- $link := printf "%v/404.html" .LanguagePrefix -}}
<option value="{{ $link }}"{{ if eq . $.Site }} selected disabled{{ end }}>
{{- .Language.LanguageName -}}
</option>
{{- end -}}
{{- else if gt (len .AllTranslations) 1 -}}
{{- range .AllTranslations -}}
<option value="{{ .RelPermalink }}"{{ if eq .Lang $.Lang }} selected disabled{{ end }}>
{{- .Language.LanguageName -}}
</option>
{{- end -}}
{{- else -}}
<option disabled>{{- T "header.noMoretTranslations" -}}</option>
{{- end -}}
</select>
</span>
{{- end -}}
</li>
</ul>
</nav>
</div>
</header>
{{- if .Site.Params.search.enable -}}
<div class="search-dropdown desktop">
<div id="search-dropdown-desktop"></div>
</div>
<div class="search-dropdown mobile">
<div id="search-dropdown-mobile"></div>
</div>
{{- end -}}

View File

@ -0,0 +1,114 @@
{{- $profile := .Site.Params.home.profile -}}
<div class="home-profile">
{{- $avatar := $profile.avatarURL -}}
{{- $gravatar := .Site.Params.gravatar -}}
{{- if $gravatar.enable | and $profile.gravatarEmail -}}
{{- with $gravatar -}}
{{- $avatar = printf "https://%v/avatar/%v?s=240&d=%v"
(path.Clean .Host | default "www.gravatar.com")
(md5 $profile.gravatarEmail)
(.Style | default "mp")
-}}
{{- end -}}
{{- end -}}
{{- if $avatar -}}
<div class="home-avatar">
{{- $menus := $.Site.Menus.main | default slice -}}
{{- $avatarMenuIndex := 0 -}}
{{- if $profile.avatarMenu -}}
{{- range $index, $menu := $menus -}}
{{- if eq $menu.Identifier $profile.avatarMenu -}}
{{- $avatarMenuIndex = $index -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- with index $menus $avatarMenuIndex -}}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
{{- dict "Src" $avatar "Alt" $.Site.Author.name | partial "plugin/image.html" -}}
</a>
{{- else -}}
{{- dict "Src" $avatar "Alt" $.Site.Author.name | partial "plugin/image.html" -}}
{{- end -}}
</div>
{{- end -}}
{{- with $profile.title -}}
<h1 class="home-title">
{{- . | safeHTML -}}
</h1>
{{- end -}}
{{- with $profile.subtitle -}}
<h2 class="home-subtitle">
{{- if $profile.typeit -}}
{{- $id := dict "Content" . "Scratch" $.Scratch "Id" "typeit-profile-subtitle" | partial "function/id.html" -}}
<span class="d-none">{{ . }}</span>
<span id="{{ $id }}" class="typeit"></span>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
{{- . -}}
{{- end -}}
</h2>
{{- end -}}
{{- if $profile.social -}}
<div class="links">
{{- $socialMap := resources.Get "data/social.yml" | transform.Unmarshal -}}
{{- $socialArr := slice -}}
{{- range $key, $value := .Site.Params.social -}}
{{- $social := $key | lower | index $socialMap | default dict -}}
{{- if $value -}}
{{- if reflect.IsMap $value -}}
{{- with $value.weight -}}
{{- $social = dict "Weight" . | merge $social -}}
{{- end -}}
{{- with $value.prefix -}}
{{- $social = dict "Prefix" . | merge $social -}}
{{- end -}}
{{- with $value.template -}}
{{- $social = dict "Template" . | merge $social -}}
{{- end -}}
{{- with $value.id -}}
{{- $social = dict "Id" . | merge $social -}}
{{- end -}}
{{- with $value.url -}}
{{- $social = dict "Url" . | merge $social -}}
{{- end -}}
{{- with $value.title -}}
{{- $social = dict "Title" . | merge $social -}}
{{- end -}}
{{- with $value.newtab -}}
{{- $social = dict "Newtab" . | merge $social -}}
{{- end -}}
{{- with $value.icon -}}
{{- $social = dict "Icon" . | merge $social -}}
{{- end -}}
{{- else if ne $value true -}}
{{- $social = dict "Id" $value | merge $social -}}
{{- end -}}
{{- if $social.Icon.Simpleicons -}}
{{- $prefix := ($.Scratch.Get "cdn" | default dict).simpleIconsPrefix -}}
{{- $social = dict "Prefix" $prefix | dict "Icon" | merge $social -}}
{{- end -}}
{{- $socialArr = $socialArr | append $social -}}
{{- end -}}
{{- end -}}
{{- range sort $socialArr "Weight" -}}
{{- partial "plugin/social.html" . -}}
{{- end -}}
</div>
{{- end -}}
{{- with $profile.disclaimer -}}
<h3 class="home-disclaimer">
{{- . | safeHTML -}}
</h3>
{{- end -}}
{{- /* Custom Content */ -}}
{{- partial (.Scratch.Get "customFilePath").profile . -}}
</div>

View File

@ -0,0 +1,26 @@
{{- /* Deprecated parameter detection */ -}}
{{- $warns := slice -}}
{{- $errors := slice -}}
{{- with .Site.Params.home.profile.gravatarSite -}}
{{- $warns = $warns | append "The parameter `home.profile.gravatarSite` is deprecated since v0.2.14, use `gravatar.host` instead." -}}
{{- end -}}
{{- with .Site.Params.ibruce.siteTime -}}
{{- $warns = $warns | append "The parameter `ibruce.siteTime` is deprecated since v0.2.14, use `footer.siteTime` instead." -}}
{{- end -}}
{{- with .Site.Params.autoBookmark -}}
{{- $warns = $warns | append "The parameter `autoBookmark` is deprecated since v0.2.17, use `page.autoBookmark` instead." -}}
{{- end -}}
{{- with .Site.Params.footer.siteTime -}}
{{- if not (reflect.IsMap .) -}}
{{- $warns = $warns | append "The parameter `footer.siteTime` has changed to a Map since v0.2.17. Please correct the format!" -}}
{{- end -}}
{{- end -}}
{{- if len $warns -}}
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $warns "\n - ") -}}
{{- end -}}
{{- if len $errors -}}
{{- errorf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $errors "\n - ") -}}
{{- end -}}

View File

@ -0,0 +1,32 @@
{{- /* FixIt theme environment detection */ -}}
{{- $params := .Scratch.Get "params" -}}
{{- if hugo.IsProduction -}}
{{- $cdn := .Site.Params.cdn -}}
{{- with $cdn.data -}}
{{- $cdnData := printf "data/cdn/%v" . | resources.Get | transform.Unmarshal -}}
{{- $cdn = dict "simpleIconsPrefix" $cdnData.prefix.simpleIcons -}}
{{- $prefix := $cdnData.prefix.libFiles | default "" -}}
{{- range $key, $value := $cdnData.libFiles -}}
{{- $cdn = printf "%v%v" $prefix $value | dict $key | merge $cdn -}}
{{- end -}}
{{- end -}}
{{- .Scratch.Set "cdn" $cdn -}}
{{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
{{- .Scratch.Set "analytics" .Site.Params.analytics -}}
{{- .Scratch.Set "comment" $params.comment -}}
{{- if eq .Params.comment true -}}
{{- .Scratch.Set "comment" .Site.Params.page.comment -}}
{{- else if eq .Params.comment false -}}
{{- .Scratch.Set "comment" (dict "enable" false) -}}
{{- end -}}
{{- else -}}
{{- .Scratch.Set "devOpts" .Site.Params.dev -}}
{{- if ne .Site.Params.dev.enable true -}}
{{- .Scratch.Set "devOpts" dict -}}
{{- end -}}
{{- if eq .Site .Sites.First -}}
{{- warnf "FixIt %v\n%v\n\n" (.Scratch.Get "version") (T "init.devEnvWarn") -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,30 @@
{{- $version := .Scratch.Get "version" -}}
{{- $latest := $version -}}
{{- $devOpts := .Scratch.Get "devOpts" -}}
{{- /* Check for updates */ -}}
{{- if $devOpts.c4u -}}
{{- /* Select the scope named "public_repo" to generate personal access token */ -}}
{{- $header := dict "Authorization" "" -}}
{{- with $devOpts.githubtoken -}}
{{- $header = dict "Authorization" (printf "token %v" .) -}}
{{- end -}}
{{- $latest = (getJSON "https://api.github.com/repos/hugo-fixit/FixIt/releases/latest" $header).tag_name -}}
{{- end -}}
{{- /* FixIt theme version detection */ -}}
{{- if eq .Site .Sites.First -}}
{{- if not .Site.Params.version -}}
{{- errorf "FixIt %v\n%v\n\n" $version (T "init.configurationError") -}}
{{- else if gt "0.2.0" (strings.TrimPrefix "v" .Site.Params.version) -}}
{{- errorf "FixIt %v\n%v\n\n" $version (dict "From" .Site.Params.version "To" $version | T "init.compatibilityError") -}}
{{- end -}}
{{- if (strings.HasSuffix $version "RC") | and $devOpts.c4u -}}
{{- warnf "FixIt %v\n%v\n\n" $version (T "init.RCVersionWarn") -}}
{{- end -}}
{{- if (gt $latest $version) | and $devOpts.c4u -}}
{{- warnf "FixIt %v (⬆️ %v)\n%v`git submodule update --remote --merge`\n\n" $version $latest (T "init.quicklyUpgrade") -}}
{{- end -}}
{{- end -}}
{{- .Scratch.Set "latest" $latest -}}

View File

@ -0,0 +1,6 @@
{{- /* Set customFilePath default value */ -}}
{{- $customFilePath := .Site.Params.customFilePath -}}
{{- $customFilePath = dict "aside" ($customFilePath.aside | default "custom/aside.html") | merge $customFilePath -}}
{{- $customFilePath = dict "profile" ($customFilePath.profile | default "custom/profile.html") | merge $customFilePath -}}
{{- $customFilePath = dict "footer" ($customFilePath.footer | default "custom/footer.html") | merge $customFilePath -}}
{{- .Scratch.Set "customFilePath" $customFilePath -}}

View File

@ -0,0 +1,11 @@
{{- .Scratch.Set "version" "v0.2.18" -}}
{{- .Scratch.Set "params" (.Params | merge .Site.Params.page) -}}
{{- .Scratch.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}
{{- partial "init/detection-version.html" . -}}
{{- partial "init/detection-deprecated.html" . -}}
{{- partial "init/global.html" . -}}
{{- partial "init/patch.html" . -}}
{{- partial "plugin/compatibility.html" . -}}

View File

@ -0,0 +1,70 @@
{{- /* FixIt theme patches */ -}}
{{- $params := .Scratch.Get "params" -}}
{{- /* Author data patch */ -}}
{{- $authorDefault := dict "name" "Anonymous" "link" "" "email" "" "avatar" "" -}}
{{- $author := .Site.Author | merge $authorDefault -}}
{{- $authorPost := dict -}}
{{- $gravatar := .Site.Params.gravatar -}}
{{- if reflect.IsMap $params.author -}}
{{- $authorPost = $params.author -}}
{{- else if isset $params "author" -}}
{{- $authorPost = dict "name" $params.author -}}
{{- end -}}
{{- if isset $authorPost "name" | and (ne $authorPost.name .Site.Author.name) -}}
{{- $author = $authorPost | merge $authorDefault | merge $author -}}
{{- else -}}
{{- with $authorPost.link -}}{{ $author = dict "link" . | merge $author }}{{- end -}}
{{- with $authorPost.email -}}{{ $author = dict "email" . | merge $author }}{{- end -}}
{{- with $authorPost.avatar -}}{{ $author = dict "avatar" . | merge $author }}{{- end -}}
{{- end -}}
{{- if $gravatar.enable | and $author.email -}}
{{- with $gravatar -}}
{{- $author = dict "avatar" (printf "https://%v/avatar/%v?s=32&d=%v"
(path.Clean .Host | default "www.gravatar.com")
(md5 $author.email)
(.Style | default ""))
| merge $author
-}}
{{- end -}}
{{- end -}}
{{- .Scratch.Set "author" $author -}}
{{- /* Toc data patch */ -}}
{{- $toc := $params.toc -}}
{{- if eq $toc true -}}
{{- $toc = dict "enable" true | merge .Site.Params.page.toc -}}
{{- else if eq $toc false -}}
{{- $toc = dict "enable" false -}}
{{- end -}}
{{- .Scratch.Set "toc" $toc -}}
{{- /* Reward data patch */ -}}
{{- $reward := $params.reward -}}
{{- if eq $reward true -}}
{{- $reward = dict "enable" true | merge .Site.Params.page.reward -}}
{{- else if eq $reward false -}}
{{- $reward = dict "enable" false -}}
{{- end -}}
{{- .Scratch.Set "reward" $reward -}}
{{- /* KaTeX data patch */ -}}
{{- $math := $params.math -}}
{{- if eq $math true -}}
{{- $math = dict "enable" true | merge .Site.Params.page.math -}}
{{- else if eq $math false -}}
{{- $math = dict "enable" false -}}
{{- end -}}
{{- .Scratch.Set "math" $math -}}
{{- /* SiteTime config patch */ -}}
{{- $siteTime := dict "Animate" true "Icon" "fa-solid fa-heartbeat" -}}
{{- with .Site.Params.footer.siteTime -}}
{{- if reflect.IsMap . -}}
{{- $siteTime = . -}}
{{- else -}}
{{- $siteTime = dict "enable" true "value" . | merge $siteTime -}}
{{- end -}}
{{- end -}}
{{- .Scratch.Set "siteTime" $siteTime -}}

View File

@ -0,0 +1,28 @@
{{- if gt .Paginator.TotalPages 1 -}}
<ul class="pagination">
{{- .Scratch.Set "paginator.ellipsed" false -}}
{{- 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 class="page-item{{ if eq . $.Paginator }} active{{ end }}">
<span class="page-link">
<a href="{{ .URL }}">{{ .PageNumber }}</a>
</span>
</li>
{{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
<li class="page-item">
<span class="page-link" aria-hidden="true">&hellip;</span>
</li>
{{- end -}}
{{- end -}}
</ul>
{{- end -}}

View File

@ -0,0 +1,20 @@
{{- $analytics := .Scratch.Get "analytics" | default dict -}}
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setCookieDomain", "*.www.m3tam3re.com"]);
_paq.push(["setDoNotTrack", true]);
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//stats.m3tam3re.com/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->

View File

@ -0,0 +1,22 @@
{{- $analytics := .Scratch.Get "analytics" | default dict -}}
{{- if $analytics.enable -}}
{{- /* Google Analytics */ -}}
{{- with $analytics.google.id -}}
<script>
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());
gtag('config', '{{ . }}'{{ if $analytics.google.anonymizeIP }}, { 'anonymize_ip': true }{{ end }});
</script>
{{- printf "https://www.googletagmanager.com/gtag/js?id=%v" . | dict "Async" true "Source" | partial "plugin/script.html" -}}
{{- end -}}
{{- /* Fathom Analytics */ -}}
{{- with $analytics.fathom.id -}}
<script>
window.fathom=window.fathom||function(){(fathom.q=fathom.q||[]).push(arguments);};
fathom('set', 'siteId', '{{ . }}');
fathom('trackPageview');
</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 -}}
{{- end -}}

View File

@ -0,0 +1,22 @@
{{- $compatibility := .Site.Params.compatibility | default dict -}}
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
{{- /* Polyfill.io */ -}}
{{- if $compatibility.polyfill -}}
{{- $features := slice -}}
{{- range resources.Get "data/polyfill.yml" | transform.Unmarshal -}}
{{- range . -}}
{{- $features = $features | append . -}}
{{- end -}}
{{- end -}}
{{- with $features | uniq -}}
{{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "Source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- end -}}
{{- /* object-fit-images */ -}}
{{- if $compatibility.objectFit -}}
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}

View File

@ -0,0 +1,13 @@
{{- with .Class -}}
<i class="{{ . }}" aria-hidden="true"></i>
{{- else -}}
{{- $src := .Src -}}
{{- with .Simpleicons -}}
{{- $prefix := $.Prefix | default "lib/simple-icons/icons" | strings.TrimSuffix "/" -}}
{{- $src = printf "%v/%v.svg" $prefix . -}}
{{- end -}}
{{- if (urls.Parse $src).Host | not -}}
{{- $src = (resources.Get $src | minify).RelPermalink -}}
{{- end -}}
<i data-svg-src="{{ $src }}" aria-hidden="true"></i>
{{- end -}}

View File

@ -0,0 +1,53 @@
{{- /* lightgallery */ -}}
{{- $src := .Src -}}
{{- $width := .Width -}}
{{- $height := .Height -}}
{{- with dict "Path" $src "Resources" .Resources | partial "function/resource.html" -}}
{{- $src = .RelPermalink -}}
{{- /* Resources can not get width and height of image for svg type */ -}}
{{- if (not $.Width) | and (not $.Height) | and (ne .MediaType.SubType "svg") -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{- end -}}
{{- end -}}
{{- $small := .SrcSmall | default $src -}}
{{- with dict "Path" .SrcSmall "Resources" .Resources | partial "function/resource.html" -}}
{{- $small = .RelPermalink -}}
{{- end -}}
{{- $large := .SrcLarge | default $src -}}
{{- with dict "Path" .SrcLarge "Resources" .Resources | partial "function/resource.html" -}}
{{- $large = .RelPermalink -}}
{{- end -}}
{{- $alt := .Alt | default $src -}}
{{- $caption := .Caption | default $alt -}}
{{- $loading := .Loading | default "lazy" -}}
{{- $commonScript := "this.title=this.dataset.title;this.alt=this.dataset.alt;for(const a of ['style','data-title','data-alt','onerror','onload']){this.removeAttribute(a);}" -}}
{{- $onload := printf " onload=\"%vthis.dataset.lazyloaded='';\"" $commonScript | safeHTMLAttr -}}
{{- $onerror := printf " onerror=\"%v\"" $commonScript | safeHTMLAttr -}}
{{- $style := printf " style=\"background: url(%v) no-repeat center;\"" (resources.Get "svg/loading.svg" | minify).RelPermalink | safeHTMLAttr -}}
{{- if eq $loading "eager" -}}
{{- $onload = "" -}}
{{- $onerror = "" -}}
{{- $style = "" -}}
{{- end -}}
{{- if .Linked -}}
<a class="lightgallery" href="{{ $large | safeURL }}" data-thumbnail="{{ $small | safeURL }}"{{ with $caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.Title }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .Rel }} rel="{{ . }}"{{ end }}>
{{- end -}}
<img loading="{{ $loading }}" src="{{ .Src | safeURL }}" srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x" sizes="auto"
{{- if eq $loading "eager" }} title="{{ .Title | default $alt }}" alt="{{ $alt }}"
{{- else }} data-title="{{ .Title | default $alt }}" data-alt="{{ $alt }}"{{- end -}}
{{- with $width }} width="{{ . }}"{{- end -}}
{{- with $height }} height="{{ . }}"{{- end -}}
{{- with .Class }} class="{{ . }}"{{- end -}}
{{- with $style -}}{{ . }}{{- end -}}
{{- with $onload -}}{{ . }}{{- end -}}
{{- with $onerror -}}{{ . }}{{- end -}}
{{- with .Height }} data-h{{- end -}}
/>
{{- if .Linked -}}
</a>
{{- end -}}

View File

@ -0,0 +1,69 @@
{{- $rel := "" -}}
{{- $external := false -}}
{{- $noreferrer := true -}}
{{- if eq .Noreferrer false -}}
{{- $noreferrer = false -}}
{{- end -}}
{{- if (urls.Parse .Destination).Host | or .Newtab -}}
{{- $rel = cond $noreferrer "external nofollow noopener noreferrer" "external nofollow" -}}
{{- $external = true -}}
{{- end -}}
{{- $class := .Class | default "" -}}
{{- if eq .Card true -}}
{{- $class = trim (printf "%v %v" "card-link" $class) " " -}}
{{- end -}}
<a href="{{ .Destination | safeURL }}"
{{- with .Title }} title="{{ . }}"{{- end -}}
{{- if $external -}} target="_blank"{{- end -}}
{{- if $rel | or .Rel }} rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"{{- end -}}
{{- with $class }} class="{{ with $class }}{{ . }}{{ end }}"{{- end -}}
{{- with .Download }} download="{{ . }}"{{- end -}}
>
{{- if ne .Card true -}}
{{- with .Icon -}}
{{- partial "plugin/icon.html" . }}
{{ end -}}
{{- with .Content -}}
{{- . | safeHTML -}}
{{- end -}}
{{- if
(.ExternalIcon | default false)
| and $external | and (eq (hasPrefix .Content `<img` ) false)
| and (eq ((strings.HasSuffix .Content `</i>`) | or (strings.HasSuffix .Content `):`)) false)
-}}
{{- if .Download -}}
{{- dict "Class" "fa-solid fa-cloud-download-alt fa-fw ms-1 text-secondary" | partial "plugin/icon.html" -}}
{{- else -}}
{{- dict "Class" "fa-solid fa-external-link-alt fa-fw fa-xs ms-1 text-secondary" | partial "plugin/icon.html" -}}
{{- end -}}
{{- else if .Download }}
{{- dict "Class" "fa-solid fa-download fa-fw ms-1 text-secondary" | partial "plugin/icon.html" -}}
{{- end -}}
{{- else -}}
<span class="cl-backdrop" {{ printf "style=\"--cl-bg-url: url(%v);\"" (resources.Get "fixit.svg" | minify).RelPermalink | safeHTMLAttr }}></span>
<span class="cl-content">
<span class="cl-text">
<span class="cl-title">
{{- with .Icon -}}
{{- partial "plugin/icon.html" . }}
{{ end -}}
{{- with .Content -}}
{{- . | safeHTML -}}
{{- end -}}
</span>
<span class="cl-meta">
<svg class="cl-icon-link" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M574 665.4c-3.1-3.1-8.2-3.1-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8c-3.1-3.1-8.2-3.1-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zM832.6 191.4c-84.6-84.6-221.5-84.6-306 0L410.3 307.6c-3.1 3.1-3.1 8.2 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6c-3.1 3.1-3.1 8.2 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1z" fill="#a9a9b3"></path><path d="M610.1 372.3c-3.1-3.1-8.2-3.1-11.3 0L372.3 598.7c-3.1 3.1-3.1 8.2 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z" fill="#a9a9b3"></path></svg>
<span class="cl-url">
{{- .Destination | safeURL -}}
</span>
</span>
</span>
{{- if .Download -}}
<svg class="cl-icon-download" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64"><path d="M824.32 473.6c-15.36-2.56-25.6-15.36-25.6-30.72 0-112.64-71.68-217.6-179.2-250.88-148.48-46.08-289.28 38.4-332.8 166.4-2.56 10.24-12.8 17.92-23.04 20.48C143.36 401.92 51.2 509.44 51.2 637.44v2.56c0 115.2 97.28 204.8 209.92 204.8h524.8c102.4-2.56 184.32-84.48 184.32-186.88 2.56-89.6-61.44-163.84-145.92-184.32z m-273.92 225.28c-12.8 12.8-30.72 15.36-46.08 10.24H501.76c-5.12-2.56-10.24-5.12-15.36-10.24L366.08 578.56c-15.36-15.36-15.36-43.52 0-58.88 15.36-15.36 43.52-15.36 58.88 0l51.2 51.2V352.4608c0-23.04 17.92-40.96 40.96-40.96 23.04 0 40.96 17.92 40.96 40.96v218.4192l51.2-51.2c17.92-17.92 43.52-17.92 61.44 0 17.92 15.36 17.92 40.96 0 58.88l-120.32 120.32z" fill="#4FC089"></path></svg>
{{- else -}}
<svg class="cl-icon-globe" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64"><path d="M960 512c0 249.408-203.2 448-448 448-244.778667 0-448-198.592-448-448S262.592 64 512 64s448 198.592 448 448" fill="#2196F3"></path><path d="M507.52 718.08c0-8.96-4.48-13.44-13.44-17.92-26.88-8.96-53.76-8.96-76.16-31.381333-4.48-8.96-4.48-17.92-8.96-26.88-8.96-8.96-31.36-13.44-44.8-17.92h-89.6c-13.44-4.48-22.4-22.4-31.36-35.84 0-4.48 0-13.461333-8.96-13.461334-8.96-4.458667-17.92 4.501333-26.88 0-4.48-4.458667-4.48-8.96-4.48-13.418666 0-13.461333 8.96-26.901333 17.92-35.861334 13.44-8.96 26.88 4.48 40.32 4.48 4.48 0 4.48 0 8.96 4.48 13.44 4.48 17.92 22.4 17.92 35.861334v8.96c0 4.48 4.48 4.48 8.96 4.48 4.48-22.4 4.48-44.821333 8.96-67.2 0-26.88 26.88-53.781333 49.28-62.72 8.96-4.458667 13.44 4.501333 22.4 0 26.88-8.96 94.08-35.84 80.64-71.658667-8.96-31.381333-35.84-62.698667-71.68-58.24-8.96 4.501333-13.44 8.96-22.4 13.461333-13.44 8.96-40.32 35.84-53.76 35.84-22.4-4.48-22.4-35.84-17.92-49.301333 4.48-17.92 44.8-76.138667 71.68-67.178667l17.92 17.92c8.96 4.48 22.4 4.48 35.84 4.48 4.48 0 8.96 0 13.44-4.48 4.48-4.48 4.48-4.48 4.48-8.96 0-13.44-13.44-26.901333-22.4-35.861333s-22.4-17.92-35.84-22.378667c-44.8-13.461333-116.48 4.458667-152.32 35.84-35.84 31.36-62.72 85.12-80.64 129.92-8.96 26.88-17.92 62.698667-22.4 94.08-4.48 22.4-8.96 40.32 4.48 62.698667 13.44 26.88 40.32 53.781333 67.2 71.68 17.92 13.44 53.76 13.44 71.68 35.84 13.44 17.941333 8.96 40.32 8.96 62.72 0 26.88 17.92 49.28 26.88 71.658667 4.48 13.461333 8.96 31.381333 13.44 44.821333 0 4.48 4.48 31.36 4.48 35.84 26.88 13.44 49.28 26.901333 80.64 35.861333 4.48 0 22.4-26.901333 22.4-31.381333 13.44-13.44 22.4-31.36 35.84-40.32 8.96-4.48 17.92-8.96 26.88-17.941333 8.96-8.96 13.44-26.88 17.92-40.32 4.48-8.938667 8.96-26.858667 4.48-40.298667M516.48 305.92c4.48 0 8.96-4.48 17.92-8.96 13.44-8.96 26.901333-22.4 40.32-31.36 13.461333-8.96 26.901333-22.4 35.861333-31.36 13.44-8.96 22.4-26.88 26.88-40.341333 4.48-8.96 17.941333-26.88 13.44-40.32-4.48-8.96-26.88-13.44-35.84-17.92C579.2 126.698667 547.84 122.24 512 122.24c-13.44 0-31.36 4.458667-35.84 17.92-4.48 22.4 13.44 17.92 31.36 22.4 0 0 4.48 35.84 4.48 40.32 4.48 22.421333-8.96 35.84-8.96 58.24 0 13.44 0 35.84 8.96 44.8h4.48zM892.8 619.52c4.501333-8.96 4.501333-22.4 8.96-31.36 4.501333-22.421333 4.501333-44.8 4.501333-67.2 0-44.8-4.501333-89.578667-17.92-129.92-8.96-13.44-13.461333-26.88-17.941333-40.341333-8.96-22.378667-22.4-44.8-40.32-62.698667-17.92-22.4-40.341333-85.12-80.64-67.2-13.44 4.501333-22.4 22.421333-31.36 31.381333l-26.88 40.32c-4.501333 4.48-8.96 13.44-4.501333 17.92 0 4.48 4.501333 4.48 8.96 4.48 8.96 4.501333 13.461333 4.501333 22.421333 8.96 4.48 0 8.96 4.501333 4.48 8.96 0 0 0 4.501333-4.48 4.501334-22.421333 22.4-44.8 40.32-67.2 62.698666-4.48 4.48-8.96 13.44-8.96 17.92s4.48 4.48 4.48 8.96c0 4.501333-4.48 4.501333-8.96 8.96-8.96 4.501333-17.92 8.96-22.4 13.461334-4.48 8.96 0 22.4-4.48 31.36-4.48 22.4-17.941333 40.32-26.901333 62.72-8.96 13.418667-13.418667 26.88-22.378667 40.32 0 17.92-4.501333 31.36 4.458667 44.8 22.421333 31.36 62.72 13.44 94.08 26.901333 8.96 4.458667 17.92 4.458667 22.421333 13.418667 13.418667 13.461333 13.418667 35.861333 17.92 49.301333 4.458667 17.92 8.96 35.84 17.92 53.76 4.48 22.421333 13.44 44.821333 17.92 62.72 40.341333-31.36 76.16-67.178667 103.04-112 26.88-31.424 40.341333-67.242667 53.76-103.104" fill="#CDDC39"></path></svg>
{{- end -}}
</span>
{{- end -}}
</a>
{{- /* EOF */ -}}

View File

@ -0,0 +1,22 @@
{{- $reward := .Reward -}}
{{- $id := .Id -}}
{{- $author := .Author -}}
{{- if $reward.enable -}}
<div class="post-reward">
<div class="comment">{{ $reward.comment }}</div>
<input type="checkbox" class="reward-input" name="reward" id="{{ $id }}" hidden />
<label class="reward-button" for="{{ $id }}">{{ T "single.reward.donate" }}</label>
<div class="reward-ways"{{ with $reward.mode }} data-mode="{{ . }}"{{ end }}>
{{- range $way, $image := $reward.ways -}}
{{- with T (printf "single.reward.%v" $way) -}}{{ $way = . }}{{- end -}}
{{- if $image -}}
<div>
{{- dict "Src" $image "Alt" (printf "%v %v" $author $way) "Resources" $.Resources | partial "plugin/image.html" -}}
<span{{ if $reward.animation }} data-animation{{ end }}>{{ $way }}</span>
</div>
{{- end -}}
{{- end -}}
</div>
</div>
{{- end -}}

View File

@ -0,0 +1,44 @@
{{- with .Content -}}
<script>{{ . | safeJS }}</script>
{{- else -}}
{{- 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 .Build -}}
{{- $resource = $resource | js.Build . -}}
{{- end -}}
{{- with .Fingerprint -}}
{{- $resource = $resource | fingerprint . -}}
{{- $integrity = $resource.Data.Integrity -}}
{{- end -}}
{{- $src = $resource.RelPermalink -}}
{{- end -}}
{{- $attrs := printf `src="%v"` $src -}}
{{- if .Crossorigin -}}
{{- $attrs = ` crossorigin="anonymous"` | add $attrs -}}
{{- end -}}
{{- with $integrity -}}
{{- $attrs = printf ` integrity="%v"` . | add $attrs -}}
{{- end -}}
{{- if .Async -}}
{{- $attrs = " async" | add $attrs -}}
{{- end -}}
{{- if .Defer -}}
{{- $attrs = " defer" | add $attrs -}}
{{- end -}}
{{- with .Attr -}}
{{- $attrs = add " " . | add $attrs -}}
{{- end -}}
<script {{ $attrs | safeHTMLAttr }}></script>
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,199 @@
{{- $share := (.Scratch.Get "params").share | default dict -}}
{{- if $share.enable -}}
{{- /* 001: Twitter */ -}}
{{- if $share.Twitter -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Twitter" data-sharer="twitter" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.tags }} data-hashtags="{{ delimit . `,` }}"{{ end }}>
{{- dict "Src" "svg/icons/x.svg" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 002: Facebook */ -}}
{{- if $share.Facebook -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Facebook" data-sharer="facebook" data-url="{{ .Permalink }}"{{ with .Params.tags }} data-hashtag="{{ index . 0 }}"{{ end }}>
{{- dict "Class" "fa-brands fa-facebook-square fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 003: Linkedin */ -}}
{{- if $share.Linkedin -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Linkedin" data-sharer="linkedin" data-url="{{ .Permalink }}">
{{- dict "Class" "fa-brands fa-linkedin fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 004: WhatsApp */ -}}
{{- if $share.Whatsapp -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} WhatsApp" data-sharer="whatsapp" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-web>
{{- dict "Class" "fa-brands fa-whatsapp fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 005: Viber */ -}}
{{- if $share.Viber -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Viber" data-sharer="viber" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fa-brands fa-viber fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 006: Pinterest */ -}}
{{- if $share.Pinterest -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pinterest" data-sharer="pinterest" data-url="{{ .Permalink }}"{{ with .Description }} data-description="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
{{- dict "Class" "fa-brands fa-pinterest fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 007: Tumblr */ -}}
{{- if $share.Tumblr -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Tumblr" data-sharer="tumblr" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.tags }} data-tags="{{ delimit . `,` }}"{{ end }}>
{{- dict "Class" "fa-brands fa-tumblr fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 008: Hacker News */ -}}
{{- if $share.Hackernews -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Hacker News" data-sharer="hackernews" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fa-brands fa-hacker-news fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 009: Reddit */ -}}
{{- if $share.Reddit -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Reddit" data-sharer="reddit" data-url="{{ .Permalink }}">
{{- dict "Class" "fa-brands fa-reddit fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 010: VK */ -}}
{{- if $share.VK -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} VK" data-sharer="vk" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
{{- dict "Class" "fa-brands fa-vk fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 011: Buffer */ -}}
{{- if $share.Buffer -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Buffer" data-sharer="buffer" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-picture="{{ . }}"{{ end }}>
{{- dict "Class" "fa-brands fa-buffer fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 012: Xing */ -}}
{{- if $share.Xing -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Xing" data-sharer="xing" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fa-brands fa-xing fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 013: Line */ -}}
{{- if $share.Line -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Line" data-sharer="line" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Simpleicons" "line" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 014: Instapaper */ -}}
{{- if $share.Instapaper -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Instapaper" data-sharer="instapaper" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- dict "Simpleicons" "instapaper" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 015: Pocket */ -}}
{{- if $share.Pocket -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pocket" data-sharer="pocket" data-url="{{ .Permalink }}">
{{- dict "Class" "fa-brands fa-get-pocket fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 016: Digg */ -}}
{{- if $share.Digg -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Digg" data-sharer="digg" data-url="{{ .Permalink }}">
{{- dict "Class" "fa-brands fa-digg fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 017: StumbleUpon */ -}}
{{- if $share.Stumbleupon -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} StumbleUpon" data-sharer="stumbleupon" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fa-brands fa-stumbleupon fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 018: Flipboard */ -}}
{{- if $share.Flipboard -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Flipboard" data-sharer="flipboard" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fa-brands fa-flipboard fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 019: 微博 */ -}}
{{- if $share.Weibo -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} 微博" data-sharer="weibo" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}{{ with .Site.Params.Social.Weibo }} data-ralateuid="{{ . }}"{{ end }}>
{{- dict "Class" "fa-brands fa-weibo fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 020: 人人 */ -}}
{{- if $share.Renren -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} 人人" data-sharer="renren" data-url="{{ .Permalink }}">
{{- dict "Class" "fa-brands fa-renren fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 021: Myspace */ -}}
{{- if $share.Myspace -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Myspace" data-sharer="myspace" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- dict "Simpleicons" "myspace" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 022: Blogger */ -}}
{{- if $share.Blogger -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Blogger" data-sharer="blogger" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- dict "Class" "fa-brands fa-blogger fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 023: 百度 */ -}}
{{- if $share.Baidu -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Simpleicons" "baidu" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 024: OK.RU */ -}}
{{- if $share.Odnoklassniki -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} OK.RU" data-sharer="okru" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fa-brands fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 025: Evernote */ -}}
{{- if $share.Evernote -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Evernote" data-sharer="evernote" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fa-brands fa-evernote fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 026: Skype */ -}}
{{- if $share.Skype -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Skype" data-sharer="skype" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
{{- dict "Class" "fa-brands fa-skype fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 027: Trello */ -}}
{{- if $share.Trello -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Trello" data-sharer="trello" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
{{- dict "Class" "fa-brands fa-trello fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 028: Mix */ -}}
{{- if $share.Mix -}}
<a href="//mix.com/add?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="{{ T `shareOn` }} Mix">
{{- dict "Class" "fa-brands fa-mix fa-fw" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- end -}}

View File

@ -0,0 +1,11 @@
{{- $destination := "" -}}
{{- with .Url -}}
{{- $destination = . | relLangURL -}}
{{- else -}}
{{- $template := .Template | default "%v" -}}
{{- with .Prefix -}}
{{- $template = . | strings.TrimSuffix "/" | printf "%v/%%v" -}}
{{- end -}}
{{- $destination = printf (string $template) .Id -}}
{{- end -}}
{{- dict "Destination" $destination "Rel" "me" | merge . | partial "plugin/link.html" -}}

View File

@ -0,0 +1,31 @@
{{- if strings.HasPrefix .Source "<link" -}}
{{- safeHTML .Source -}}
{{- else -}}
{{- $href := .Source -}}
{{- $integrity := .Integrity -}}
{{- $resource := 0 -}}
{{- if $href | and (not (urls.Parse $href).Host) -}}
{{- $resource = resources.Get $href -}}
{{- end -}}
{{- with .Content -}}
{{- $resource = resources.FromString $.Path . -}}
{{- end -}}
{{- if $resource -}}
{{- with .Template -}}
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
{{- end -}}
{{- with .ToCSS -}}
{{- $options := . | merge (dict "outputStyle" "compressed") -}}
{{- $resource = $resource | toCSS $options -}}
{{- end -}}
{{- if .Minify -}}
{{- $resource = $resource | minify -}}
{{- end -}}
{{- with .Fingerprint -}}
{{- $resource = $resource | fingerprint . -}}
{{- $integrity = $resource.Data.Integrity -}}
{{- end -}}
{{- $href = $resource.RelPermalink -}}
{{- end -}}
<link rel="stylesheet" href="{{ $href }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}>
{{- end -}}

View File

@ -0,0 +1,25 @@
{{- if and .Site.Params.section.recentlyUpdated.enable (eq $.Paginator.PageNumber 1) -}}
{{- $hasTitle := false }}
{{- $postCount := 0 -}}
{{- $maxPostCount := .Site.Params.section.recentlyUpdated.maxCount | default 10 -}}
{{- $days := .Site.Params.section.recentlyUpdated.days | default 30 -}}
{{- range first $maxPostCount (where .Data.Pages.ByLastmod.Reverse "Section" "!=" "") -}}
{{- if gt (add .Lastmod.Unix (mul 86900 $days)) now.Unix -}}
{{- if ne .Lastmod.Unix .Date.Unix }}
{{- $postCount = add $postCount 1 -}}
{{- if eq $hasTitle false -}}
<h2 class="group-title">{{- T "section.recentlyUpdated" -}}</h2>
{{- $hasTitle = true -}}
{{- end -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Lastmod.Format }}'>
{{- with .Site.Params.section.dateformat | default "01-02" | .Lastmod.Format -}}
{{- dict "Date" . | T "single.updatedOnDate" -}}
{{- end -}}
</span>
</article>
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,43 @@
{{- $params := .Page.Params | merge .Site.Params.Page -}}
{{- $authorName := .Site.Author.name | default (T "single.author") -}}
{{- with .Params.author -}}
{{- if reflect.IsMap . -}}
{{- $authorName = cond (isset . "name") .name $authorName -}}
{{- else -}}
{{- $authorName = . -}}
{{- end -}}
{{- end -}}
<item>
<title>
{{- .Page.Title -}}
</title>
<link>
{{- .Page.Permalink -}}
</link>
<pubDate>
{{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate>
<author>{{ $authorName }}</author>
<guid>
{{- .Page.Permalink -}}
</guid>
<description>
{{- "<![CDATA[" | safeHTML -}}
{{- with $params.featuredimage -}}
<div class="featured-image">
<img src="{{ . | relURL }}" referrerpolicy="no-referrer">
</div>
{{- end -}}
{{- $content := .Page.Description -}}
{{- if $params.rssFullText -}}
{{- $content = dict "Content" .Page.Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{- else -}}
{{- with .Page.Summary -}}
{{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{- end -}}
{{- end -}}
{{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}}
{{- "]]>" | safeHTML -}}
</description>
</item>

View File

@ -0,0 +1,4 @@
{{- $this := .Scratch.Get "this" -}}
{{- $script := $this.script | default slice -}}
{{- $script = $script | append (slice .Data) -}}
{{- .Scratch.SetInMap "this" "script" $script -}}

View File

@ -0,0 +1,4 @@
{{- $this := .Scratch.Get "this" -}}
{{- $style := $this.style | default slice -}}
{{- $style = $style | append (slice .Data) -}}
{{- .Scratch.SetInMap "this" "style" $style -}}

View File

@ -0,0 +1,343 @@
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
{{- $comment := .Scratch.Get "comment" | default dict -}}
{{- $commentConfig := dict "enable" false -}}
{{- if $comment.enable -}}
{{- $commentConfig = dict "enable" true "expired" (.Scratch.Get "commentExpired" | default false) -}}
<div id="comments">
{{- /* Artalk Comment System */ -}}
{{- $artalk := $comment.artalk | default dict -}}
{{- if $artalk.enable -}}
<div id="artalk" class="comment"></div>
{{- $source := $cdn.artalkCSS | default "lib/artalk/Artalk.css" -}}
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.artalkJS | default "lib/artalk/Artalk.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "el" "#artalk" "pageKey" .Permalink "pageTitle" .Title "pvEl" "artalk-visitor-count" "countEl" "artalk-comment-count" | dict "artalk" | merge $commentConfig -}}
{{- if (eq $artalk.locale "") | and (eq $.Site.LanguageCode "en") -}}
{{- $artalk = dict "locale" "en-US" | merge $artalk -}}
{{- end -}}
{{- $commentConfig = dict "locale" ($artalk.locale | default $.Site.LanguageCode | default "auto") | dict "artalk" | merge $commentConfig -}}
{{- with .Site.Params.gravatar -}}
{{- $commentConfig = dict "mirror" .Host "default" .Style | dict "gravatar" | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.server -}}
{{- $commentConfig = dict "server" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.site -}}
{{- $commentConfig = dict "site" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.placeholder -}}
{{- $commentConfig = dict "placeholder" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.nocomment -}}
{{- $commentConfig = dict "noComment" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.sendbtn -}}
{{- $commentConfig = dict "sendBtn" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.editortravel -}}
{{- $commentConfig = dict "editorTravel" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- if ne $artalk.flatmode nil -}}
{{- $commentConfig = dict "flatMode" $artalk.flatmode | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.nestmax -}}
{{- $commentConfig = dict "nestMax" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.nestsort -}}
{{- $commentConfig = dict "nestSort" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.lightgallery -}}
{{- $commentConfig = dict "lightgallery" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- if eq $artalk.vote false -}}
{{- $commentConfig = dict "vote" false | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- with $artalk.votedown -}}
{{- $commentConfig = dict "voteDown" . | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- if eq $artalk.uabadge false -}}
{{- $commentConfig = dict "uaBadge" false | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- if eq $artalk.listsort false -}}
{{- $commentConfig = dict "listSort" false | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- if eq $artalk.imgupload false -}}
{{- $commentConfig = dict "imgUpload" false | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- if eq $artalk.preview false -}}
{{- $commentConfig = dict "preview" false | dict "artalk" | merge $commentConfig -}}
{{- end -}}
{{- if eq $artalk.versioncheck false -}}
{{- $commentConfig = dict "versionCheck" false | dict "artalk" | merge $commentConfig -}}
{{- end -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://github.com/ArtalkJS/Artalk" rel="external nofollow noopener noreferrer">Artalk</a>.
</noscript>
{{- end -}}
{{- /* Disqus Comment System */ -}}
{{- $disqus := $comment.disqus | default dict -}}
{{- if $disqus.enable -}}
<div id="disqus_thread" class="comment"></div>
{{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}}
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript" rel="external nofollow noopener noreferrer">Disqus</a>.
</noscript>
{{- end -}}
{{- /* Gitalk Comment System */ -}}
{{- $gitalk := $comment.gitalk | default dict -}}
{{- if $gitalk.enable -}}
<div id="gitalk" class="comment"></div>
{{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}}
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk" rel="external nofollow noopener noreferrer">Gitalk</a>.
</noscript>
{{- end -}}
{{- /* Valine Comment System */ -}}
{{- $valine := $comment.valine | default dict -}}
{{- if $valine.enable -}}
<div id="valine" class="comment"></div>
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
{{- dict "Source" "lib/valine/valine.scss" "ToCSS" $options | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "comment.valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}}
{{- with $valine.avatar -}}
{{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}}
{{- end -}}
{{- with $valine.meta -}}
{{- $commentConfig = dict "meta" . | dict "valine" | merge $commentConfig -}}
{{- end -}}
{{- with $valine.requiredFields -}}
{{- $commentConfig = dict "requiredFields" . | dict "valine" | merge $commentConfig -}}
{{- end -}}
{{- with $valine.pageSize -}}
{{- $commentConfig = dict "pageSize" . | dict "valine" | merge $commentConfig -}}
{{- end -}}
{{- with $valine.serverURLs -}}
{{- $commentConfig = dict "serverURLs" . | dict "valine" | merge $commentConfig -}}
{{- end -}}
{{- $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/" rel="external nofollow noopener noreferrer">Valine</a>.
</noscript>
{{- end -}}
{{- /* Waline Comment System */ -}}
{{- /* see https://waline.js.org/reference/component.html */ -}}
{{- $waline := $comment.waline | default dict -}}
{{- if $waline.enable -}}
<div id="waline" class="comment"></div>
{{- $source := $cdn.walineCSS | default "lib/waline/waline.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.walineJS | default "lib/waline/waline.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "el" "#waline" "serverURL" $waline.serverURL "lang" .Lang "dark" "body[data-theme='dark']" | dict "waline" | merge $commentConfig -}}
{{- $commentConfig = dict "copyright" true "imageUploader" false "highlighter" false "texRenderer" false "search" false | dict "waline" | merge $commentConfig -}}
{{- with $waline.pageview -}}
{{- $commentConfig = dict "pageview" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.emoji -}}
{{- $commentConfig = dict "emoji" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.meta -}}
{{- $commentConfig = dict "meta" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.requiredMeta -}}
{{- $commentConfig = dict "requiredMeta" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.login -}}
{{- $commentConfig = dict "login" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.wordLimit -}}
{{- $commentConfig = dict "wordLimit" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.pageSize -}}
{{- $commentConfig = dict "pageSize" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.imageUploader -}}
{{- $commentConfig = dict "imageUploader" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.highlighter -}}
{{- $commentConfig = dict "highlighter" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.comment -}}
{{- $commentConfig = dict "comment" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.texRenderer -}}
{{- $commentConfig = dict "texRenderer" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.search -}}
{{- $commentConfig = dict "search" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.recaptchaV3Key -}}
{{- $commentConfig = dict "recaptchaV3Key" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
{{- with $waline.reaction -}}
{{- $commentConfig = dict "reaction" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://waline.js.org/" rel="external nofollow noopener noreferrer">Waline</a>.
</noscript>
{{- end -}}
{{- /* Facebook Comment System */ -}}
{{- $facebook := $comment.facebook | default dict -}}
{{- if $facebook.enable -}}
<div id="fb-root" class="comment"></div>
<div
class="fb-comments"
data-href="{{ .Permalink }}"
data-width="{{ $facebook.width }}"
data-numposts="{{ $facebook.numPosts }}"
></div>
{{- $source := printf "https://connect.facebook.net/%v/sdk.js#xfbml=1&version=v5.0&appId=%v&autoLogAppEvents=1" ($facebook.languageCode | default (T "comment.facebookLanguageCode")) $facebook.appId -}}
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/" rel="external nofollow noopener noreferrer">Facebook</a>.
</noscript>
{{- end -}}
{{- /* 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/" rel="external nofollow noopener noreferrer">Telegram Comments</a>.
</noscript>
{{- end -}}
{{- /* Commento Comment System */ -}}
{{- $commento := $comment.commento | default dict -}}
{{- if $commento.enable -}}
<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/" rel="external nofollow noopener noreferrer">Commento</a>.
</noscript>
{{- end -}}
{{- /* Utterances Comment System */ -}}
{{- $utterances := $comment.utterances | default dict -}}
{{- if $utterances.enable -}}
<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/" rel="external nofollow noopener noreferrer">Utterances</a>.
</noscript>
{{- end -}}
{{- /* Twikoo Comment System */ -}}
{{- $twikoo := $comment.twikoo | default dict -}}
{{- if $twikoo.enable -}}
<div id="twikoo"></div>
{{- $source := $cdn.twikooJS | default "lib/twikoo/twikoo.all.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "el" "#twikoo" "envId" $twikoo.envId "lang" .Lang | dict "twikoo" | merge $commentConfig -}}
{{- with $twikoo.region -}}
{{- $commentConfig = dict "region" . | dict "twikoo" | merge $commentConfig -}}
{{- end -}}
{{- with $twikoo.path -}}
{{- $commentConfig = dict "path" . | dict "twikoo" | merge $commentConfig -}}
{{- end -}}
{{- with $twikoo.commentCount -}}
{{- $commentConfig = dict "commentCount" . | dict "twikoo" | merge $commentConfig -}}
{{- end -}}
{{- with $twikoo.lightgallery -}}
{{- $commentConfig = dict "lightgallery" . | dict "twikoo" | merge $commentConfig -}}
{{- end -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://twikoo.js.org/" rel="external nofollow noopener noreferrer">Twikoo</a>.
</noscript>
{{- end -}}
{{- /* Giscus Comment System */ -}}
{{- $giscus := $comment.giscus | default dict -}}
{{- if $giscus.enable -}}
{{- with $giscus -}}
{{- $commentConfig = .lightTheme | default "light" | dict "lightTheme" | dict "giscus" | merge $commentConfig -}}
{{- $commentConfig = .darkTheme | default "dark" | dict "darkTheme" | dict "giscus" | merge $commentConfig -}}
<div id="giscus">
<script
src="https://giscus.app/client.js"
data-repo="{{ .Repo }}"
data-repo-id="{{ .RepoId }}"
data-category="{{ .Category }}"
data-category-id="{{ .CategoryId }}"
data-mapping="{{ .Mapping }}"
data-strict="{{ .Strict }}"
{{ if .Term }}data-term="{{ .Term }}"{{ end }}
data-theme="preferred_color_scheme"
data-reactions-enabled="{{ .ReactionsEnabled }}"
data-emit-metadata="{{ .EmitMetadata }}"
data-input-position="{{ .InputPosition }}"
data-lang="{{ $.Site.LanguageCode }}"
{{ if ne .LazyLoad false }}data-loading="lazy"{{ end }}
crossorigin="anonymous"
async
defer
></script>
</div>
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://giscus.app/" rel="external nofollow noopener noreferrer">giscus</a>.
</noscript>
{{- end -}}
{{- end -}}
</div>
{{- /* lightgallery for Artalk and Twikoo */ -}}
{{- $params := .Scratch.Get "params" -}}
{{- if not $params.lightgallery | and (($artalk.enable | and $artalk.lightgallery) | or ($twikoo.enable | and $twikoo.lightgallery)) -}}
{{- $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 "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/plugins/thumbnail/lg-thumbnail.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/plugins/zoom/lg-zoom.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- /* KaTeX for Twikoo */ -}}
{{- $math := .Scratch.Get "math" -}}
{{- if not $math.enable | and $twikoo.enable | and $twikoo.katex -}}
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
{{- 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 "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- end -}}
{{- dict "comment" $commentConfig | dict "config" | merge (.Scratch.Get "this") | .Scratch.Set "this" -}}

View File

@ -0,0 +1,30 @@
{{- $params := .Scratch.Get "params" -}}
{{- $expirationReminder := $params.expirationReminder | default dict -}}
{{- if $expirationReminder.enable -}}
{{- $daysAgo := div (sub now.Unix .Lastmod.Unix) 86400 }}
{{- $reminderThreshold := $expirationReminder.reminder | default 90 }}
{{- $warningThreshold := $expirationReminder.warning | default 180 }}
{{- $updateTime := .Lastmod }}
{{- if gt $daysAgo $reminderThreshold -}}
{{- $type := "note" -}}
{{- $icon := "fa-pencil-alt" -}}
{{- if gt $daysAgo $warningThreshold -}}
{{- $type = "warning" -}}
{{- $icon = "fa-exclamation-triangle" -}}
{{- end -}}
<div class="details admonition {{ $type }} open">
<div class="details-summary admonition-title">
<i class="icon fa-solid {{ $icon }} fa-fw" aria-hidden="true"></i>{{ T (printf "admonition.%v" $type) }}<i class="details-icon fa-solid fa-angle-right fa-fw" aria-hidden="true"></i>
</div>
<div class="details-content">
<div class="admonition-content">
{{- with .Site.Params.dateformat | default "2006-01-02" | $updateTime.Format -}}
{{- dict "Date" . | T "single.expirationReminder" -}}
{{- end -}}
</div>
</div>
</div>
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,12 @@
{{- $msg := (.Scratch.Get "params").message | default (T "single.encryptedMessage") -}}
{{- $loading := resources.Get "svg/loading.svg" | minify -}}
<div class="fixit-decryptor-container">
<img class="fixit-decryptor-loading" src="{{ $loading.RelPermalink }}" alt="decryptor loading" />
<label for="fixit-decryptor-input" title='{{ T "single.password" }}'>
<input type="password" id="fixit-decryptor-input" class="d-none" placeholder="🔑 {{ $msg }}" />
</label>
<button class="fixit-encryptor-btn d-none">
{{- dict "Class" "fa-solid fa-lock" | partial "plugin/icon.html" }} {{ T "single.encryptyAgain" -}}
</button>
</div>

View File

@ -0,0 +1,90 @@
{{- $params := .Scratch.Get "params" -}}
{{- $gitRepo := (strings.TrimSuffix "/" .Site.Params.gitRepo) -}}
<div class="post-footer" id="post-footer">
<div class="post-info">
<div class="post-info-line">
<div class="post-info-mod">
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | .Lastmod.Format) | T "single.updatedOnDate" }}">
{{- with .Site.Params.dateformat | default "2006-01-02" | .Lastmod.Format -}}
{{- dict "Date" . | T "single.updatedOnDate" -}}&nbsp;
{{- if $gitRepo -}}
{{- with $.GitInfo -}}
<a class="git-hash" href="{{ printf `%v/commit/%v` $gitRepo .Hash }}" rel="external nofollow noopener noreferrer" target="_blank" title="commit by {{ .AuthorName }}({{ .AuthorEmail }}) {{ .Hash }}: {{ .Subject }}">
{{- dict "Class" "fa-solid fa-hashtag fa-fw" | partial "plugin/icon.html" -}}
{{- .AbbreviatedHash -}}
</a>
{{- end -}}
{{- end -}}
{{- end -}}
</span>
</div>
{{- with $params.license | string -}}
<div class="post-info-license{{ with $params.password }} d-none{{ end }}">
<span>{{- . | safeHTML -}} </span>
</div>
{{- end -}}
</div>
<div class="post-info-line{{ with $params.password }} d-none{{ end }}">
<div class="post-info-md">
{{- if $params.linktomarkdown -}}
{{- with .OutputFormats.Get "markdown" -}}
<span>
{{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") "externalIcon" false -}}
{{- partial "plugin/link.html" $options -}}
</span>
{{- end -}}
{{- end -}}
{{- with $params.edit -}}
{{- if .Enable -}}
<span>
{{- $editUrl := printf "%v/%v" (strings.TrimSuffix "/" .Url) $.File.Path -}}
{{- if not (hasPrefix $editUrl "http") -}}
{{- $editUrl = printf "%v/%v" $gitRepo (strings.TrimPrefix "/" $editUrl) -}}
{{- end -}}
{{- $options := dict "Class" "link-to-edit" "Destination" $editUrl "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") "externalIcon" false -}}
{{- partial "plugin/link.html" $options -}}
</span>
{{- end -}}
{{- end -}}
</div>
<div class="post-info-share">
<span>
{{- partial "plugin/share.html" . -}}
</span>
</div>
</div>
</div>
<div class="post-info-more">
<section class="post-tags">
{{- with .Params.tags -}}
{{- dict "Class" "fa-solid fa-tags fa-fw me-1" | partial "plugin/icon.html" -}}
{{- range $value := . -}}
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
{{- with $tag -}}
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .Title }}</a>
{{- end -}}
{{- end -}}
{{- end -}}
</section>
<section>
<span><a href="javascript:void(0);" onclick="window.history.back();">{{ T "single.back" }}</a></span>&nbsp;|&nbsp;<span><a href="{{ .Site.Home.RelPermalink }}">{{ T "single.home" }}</a></span>
</section>
</div>
<div class="post-nav">
{{- with .PrevInSection -}}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="prev" title="{{ .Title }}">
{{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
{{- .Title -}}
</a>
{{- end -}}
{{ with .NextInSection }}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="next" title="{{ .Title }}">
{{- .Title -}}
{{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
</div>
</div>

View File

@ -0,0 +1,56 @@
<div class="newsletter">
<style type="text/css" scoped>
.mauticform_wrapper { max-width: 600px; margin: 10px auto; }
.mauticform-innerform {}
.mauticform-post-success {}
.mauticform-name { font-weight: bold; font-size: 1.5em; margin-bottom: 3px; }
.mauticform-description { margin-top: 2px; margin-bottom: 10px; }
.mauticform-error { margin-bottom: 10px; color: red; }
.mauticform-message { margin-bottom: 10px;color: green; }
.mauticform-row { display: block; margin-bottom: 20px; }
.mauticform-row.mauticform-required .mauticform-label:after { color: #e32; content: " *"; display: inline; }
.mauticform-helpmessage { display: block; font-size: 0.9em; margin-bottom: 3px; }
.mauticform-errormsg { display: block; color: red; margin-top: 2px; }
.mauticform-selectbox, .mauticform-input, .mauticform-textarea { width: 100%; padding: 0.5em 0.5em; border: 1px solid #CCC; background: #fff; box-shadow: 0px 0px 0px #fff inset; border-radius: 4px; box-sizing: border-box; }
.mauticform-checkboxgrp-row {}
.mauticform-checkboxgrp-label { font-weight: normal; }
.mauticform-checkboxgrp-checkbox {}
.mauticform-radiogrp-row {}
.mauticform-radiogrp-label { font-weight: normal; }
.mauticform-radiogrp-radio {}
.mauticform-button-wrapper .mauticform-button.btn-default, .mauticform-pagebreak-wrapper .mauticform-pagebreak.btn-default { color: #5d6c7c;background-color: #ffffff;border-color: #dddddd;}
.mauticform-button-wrapper .mauticform-button, .mauticform-pagebreak-wrapper .mauticform-pagebreak { display: inline-block;margin-bottom: 0;font-weight: 600;text-align: center;vertical-align: middle;cursor: pointer;background-image: none;border: 1px solid transparent;white-space: nowrap;padding: 6px 12px;font-size: 13px;line-height: 1.3856;border-radius: 3px;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}
.mauticform-button-wrapper .mauticform-button.btn-default[disabled], .mauticform-pagebreak-wrapper .mauticform-pagebreak.btn-default[disabled] { background-color: #ffffff; border-color: #dddddd; opacity: 0.75; cursor: not-allowed; }
.mauticform-pagebreak-wrapper .mauticform-button-wrapper { display: inline; }
</style><style type="text/css" scoped>
.mauticform-field-hidden { display:none }
</style>
<div id="mauticform_wrapper_doubleoptin" class="mauticform_wrapper">
<h3>{{- T "newsletterSignup" -}}</h3>
<form autocomplete="false" role="form" method="post" action="https://ma.m3tam3re.com/form/submit?formId=2" id="mauticform_doubleoptin" data-mautic-form="doubleoptin" enctype="multipart/form-data">
<div class="mauticform-error" id="mauticform_doubleoptin_error"></div>
<div class="mauticform-message" id="mauticform_doubleoptin_message"></div>
<div class="mauticform-innerform">
<div class="mauticform-page-wrapper mauticform-page-1" data-mautic-form-page="1">
<div id="mauticform_doubleoptin_first_nae" data-validate="first_nae" data-validation-type="text" class="mauticform-row mauticform-text mauticform-field-1 mauticform-required">
<input id="mauticform_input_doubleoptin_first_nae" name="mauticform[first_nae]" required placeholder="First Name" value="" class="field" type="text">
<input id="mauticform_input_doubleoptin_email" name="mauticform[email]" required placeholder="E-Mail" value="" class="field" type="email">
</div>
<div id="mauticform_doubleoptin_submit">
<button type="submit" name="mauticform[submit]" id="mauticform_input_doubleoptin_submit" value="" class="button">Submit</button>
</div>
</div>
</div>
<input type="hidden" name="mauticform[formId]" id="mauticform_doubleoptin_id" value="2">
<input type="hidden" name="mauticform[return]" id="mauticform_doubleoptin_return" value="">
<input type="hidden" name="mauticform[formName]" id="mauticform_doubleoptin_name" value="doubleoptin">
</form>
<p>{{- T "supportMe" -}}<a href="monero:42xGGy9sAXB4cJX4vrHXAh3Pq13Z8AESs1sVrpqi9mrj9euRYDEhgnjLzTk8ZFrntWFRDmAkuafEjisgyKxTVWMWRa3Bg2x" title="Monero Wallet">{{- dict "Simpleicons" "monero" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}</a> <a href="/img/wallet.png" title="Monero QR Code" target="_blank">{{- dict "Simpleicons" "monero" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}</a> <a href="https://liberapay.com/m3tam3re/" title="Liberapay">{{- dict "Simpleicons" "liberapay" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}</a> <a href="https://ko-fi.com/m3tam3re" title="Ko-Fi">{{- dict "Simpleicons" "kofi" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}</a></p>
</div>

View File

@ -0,0 +1,23 @@
{{- $params := .Scratch.Get "params" -}}
{{- $author := .Scratch.Get "author" -}}
<span class="post-author">
{{- $content := $author.name -}}
{{- $icon := dict "Class" "fa-solid fa-user-circle" -}}
{{- if $author.avatar | and $params.authorAvatar -}}
{{- $content = printf "%v&nbsp;%v" (dict "Src" $author.avatar "Class" "avatar" "Alt" $author.name | partial "plugin/image.html") $author.name -}}
{{- $icon = "" -}}
{{- end -}}
{{- if $author.link -}}
{{- $options := dict "Class" "author" "Destination" $author.link "Title" (T "single.author") "Rel" "author" "Icon" $icon "Content" $content -}}
{{- partial "plugin/link.html" $options -}}
{{- else -}}
<span class="author">
{{- with $icon -}}
{{- . | partial "plugin/icon.html" }}
{{ end -}}
{{- $content | safeHTML -}}
</span>
{{- end -}}
</span>
{{- /* EOF */ -}}

View File

@ -0,0 +1,4 @@
{{- $reward := .Scratch.Get "reward" -}}
{{- $author := .Scratch.Get "author" -}}
{{- $options := dict "Reward" $reward "Id" "fi-reward" "Author" $author.name -}}
{{- partial "plugin/reward.html" $options -}}

View File

@ -0,0 +1,59 @@
<div class="widgets">
{{- $backToTop := .Site.Params.backToTop -}}
{{- $comment := .Scratch.Get "comment" -}}
{{- if $backToTop.enable | or $comment.enable -}}
<div class="fixed-buttons animate__faster d-none">
{{- /* back to top button */ -}}
{{- if $backToTop.enable -}}
<div class="fixed-button back-to-top" role="button" aria-label="{{ T `baseof.backToTop` }}">
{{- dict "Class" "fa-solid fa-arrow-up fa-fw" | partial "plugin/icon.html" -}}
<span class="variant-numeric{{ if not $backToTop.scrollpercent }} d-none{{ end }}">0%</span>
</div>
{{- end -}}
{{- /* comment button */ -}}
{{- if $comment.enable -}}
<div class="fixed-button view-comments d-none" role="button" aria-label="{{ T `baseof.viewComments` }}">
{{- dict "Class" "fa-solid fa-comment fa-fw" | partial "plugin/icon.html" -}}
</div>
{{- end -}}
</div>
{{- end -}}
{{- /* GitHub Corners */ -}}
{{- $githubCorner := .Site.Params.githubCorner -}}
{{- if $githubCorner.enable -}}
{{- with $githubCorner -}}
{{- $githubImage := `<svg viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg>` -}}
{{- $options := dict "Destination" .Permalink "Title" .Title "Content" $githubImage "Class" (cond (eq .Position "left") "left" "right" | printf "github-corner %v d-none-mobile") "Noreferrer" false -}}
{{- partial "plugin/link.html" $options -}}
{{- end -}}
{{- end -}}
{{- /* Search mask */ -}}
<div id="mask"></div>
{{- /* Reading progress bar */ -}}
{{- $readingProgress := .Site.Params.readingProgress -}}
{{- if $readingProgress.enable -}}
{{- with $readingProgress -}}
{{- $style := printf "%v: 0;%v: 0;" (.Start | default "left") (.Position | default "top") -}}
{{- if .Height | and (ne .Height "2px") -}}
{{- $style = printf "%v--progress-h: %v;" $style .Height -}}
{{- end -}}
{{- if .Reversed -}}
{{- $style = printf "%v%v" $style "width: calc(100% - var(--progress));" -}}
{{- end -}}
{{- if .Light -}}
{{- $style = printf "%v--bg-progress: %v;" $style .Light -}}
{{- end -}}
{{- if .Dark -}}
{{- $style = printf "%v--bg-progress-dark: %v;" $style .Dark -}}
{{- end -}}
<div class="reading-progress-bar" {{ printf "style=\"%v\"" $style | safeHTMLAttr }}></div>
{{- end -}}
{{- end -}}
<noscript>
<div class="noscript-warning">{{ T "baseof.noscript" }}</div>
</noscript>
</div>

View File

@ -0,0 +1,55 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}}
</title>
<link>
{{- .Permalink -}}
</link>
<description>
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} | {{ .Site.Title -}}
</description>
<generator>Hugo -- gohugo.io</generator>
{{- with .Site.LanguageCode -}}
<language>
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
<copyright>
{{- . -}}
</copyright>
{{- end -}}
{{- if not .Date.IsZero -}}
<lastBuildDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</lastBuildDate>
{{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- if .Site.Params.section.recentlyUpdated.rss -}}
{{- $postCount := 0 -}}
{{- $maxPostCount := .Site.Params.section.recentlyUpdated.maxCount | default 10 -}}
{{- $days := .Site.Params.section.recentlyUpdated.days | default 30 -}}
{{- range (where .Data.Pages.ByLastmod.Reverse "Section" "!=" "") -}}
{{- if gt (add .Lastmod.Unix (mul 86900 $days)) now.Unix -}}
{{- if lt $postCount $maxPostCount -}}
{{- if ne .Lastmod.Unix .Date.Unix }}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- range .Pages | first (.Site.Params.section.rss | default 10) -}}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>

View File

@ -0,0 +1,216 @@
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}
{{- $toc := .Scratch.Get "toc" -}}
<aside class="toc" id="toc-auto">
{{- /* Auto TOC */ -}}
{{- $tocEmpty := eq .TableOfContents `<nav id="TableOfContents"></nav>` -}}
{{- if (ne $toc.enable false) | and (ne $tocEmpty true) -}}
<h2 class="toc-title{{ with $params.password }} d-none{{ end }}">
{{- T "single.contents" -}}&nbsp;
{{- dict "Class" "toc-icon fa-solid fa-angle-down fa-fw" | partial "plugin/icon.html" -}}
</h2>
<div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}{{ with $params.password }} d-none{{ end }}" id="toc-content-auto"></div>
{{- end -}}
</aside>
<aside class="aside-custom">
<!-- put aside for later use -->
{{- partial (.Scratch.Get "customFilePath").aside . -}}
</aside>
<article class="page single">
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__flipInX">
{{- $repost := $params.repost | default dict -}}
{{- with $repost -}}
{{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share fa-fw" -}}
{{- $title := cond (hasPrefix .Url "http") (printf "%v -> %v" (T "single.repost") .Url ) (T "single.repost") -}}
{{- if hasPrefix .Url "http" -}}
{{ dict "Destination" .Url "Icon" $icon "Class" "icon-repost" "Title" $title | partial "plugin/link.html" -}}
{{- else -}}
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
{{- end -}}
{{- end -}}
{{- end -}}
<span>{{- .Title -}}</span>
</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . }}</p>{{- end -}}
</div>
{{- /* Meta */ -}}
<div class="post-meta">
<div class="post-meta-line">
{{- partial "single/post-author.html" . -}}
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (printf `<a href="%v">%v %v</a>` (partial "function/escapeurl.html" $category.RelPermalink) (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&ensp;" }}
<span class="post-category">
{{- dict "Categories" . | T "single.includedInCategories" | safeHTML -}}
</span>
{{- end -}}
</div>
<div class="post-meta-line">
{{- with .Site.Params.dateformat | default "2006-01-02" | .PublishDate.Format -}}
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | $.PublishDate.Format) | T "single.publishedOnDate" }}">
{{- dict "Class" "fa-regular fa-calendar-alt fa-fw me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
</span>&nbsp;
{{- end -}}
{{- with .Site.Params.dateformat | default "2006-01-02" | .Lastmod.Format -}}
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | $.Lastmod.Format) | T "single.updatedOnDate" }}">
{{- dict "Class" "fa-regular fa-edit fa-fw me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
</span>&nbsp;
{{- end -}}
{{- if $params.wordCount -}}
<span>
{{- dict "Class" "fa-solid fa-pencil-alt fa-fw me-1" | partial "plugin/icon.html" -}}
{{- T "single.wordCount" .WordCount -}}
</span>&nbsp;
{{- end -}}
{{- if $params.readingTime -}}
<span>
{{- dict "Class" "fa-regular fa-clock fa-fw me-1" | partial "plugin/icon.html" -}}
{{- T "single.readingTime" .ReadingTime -}}
</span>&nbsp;
{{- end -}}
{{- /* If the article expires, close the comment or not */ -}}
{{- $expirationReminder := $params.expirationReminder | default dict -}}
{{- if
$expirationReminder.enable
| and (gt (div (sub now.Unix .Lastmod.Unix) 86400) ($expirationReminder.warning | default 180))
| and $expirationReminder.closeComment -}}
{{- .Scratch.Set "commentExpired" true -}}
{{- end -}}
{{- $comment := .Scratch.Get "comment" | default dict -}}
{{- $visitorIcon := dict "Class" "fa-regular fa-eye fa-fw me-1" | partial "plugin/icon.html" -}}
{{- $commentIcon := dict "Class" "fa-regular fa-comments fa-fw me-1" | partial "plugin/icon.html" -}}
{{- /* Visitor Count */ -}}
{{- if $comment.enable -}}
{{- if $comment.artalk.enable -}}
<span class="comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span class="artalk-visitor-count" data-page-key="{{ .RelPermalink }}">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if ($comment.valine.enable | and $comment.valine.visitor) -}}
<span id="{{ .RelPermalink }}" class="leancloud_visitors comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span class="leancloud-visitors-count">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if $comment.waline.enable | and $comment.waline.pageview -}}
<span class="comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span data-path="{{ .RelPermalink }}" class="waline-pageview-count">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if $comment.twikoo.enable | and $comment.twikoo.visitor -}}
<span id="{{ .RelPermalink }}" class="comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span id="twikoo_visitors">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if .Site.Params.ibruce.enable | and .Site.Params.ibruce.enablePost -}}
<span id="busuanzi_container_page_pv" class="busuanzi_visitors comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span id="busuanzi_value_page_pv">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- end -}}
{{- else if .Site.Params.ibruce.enable | and .Site.Params.ibruce.enablePost -}}
<span id="busuanzi_container_page_pv" class="busuanzi_visitors comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span id="busuanzi_value_page_pv">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- end -}}
{{- /* Comment Count */ -}}
{{- if $comment.enable -}}
{{- if $comment.artalk.enable -}}
<span class="comment-count" data-flag-title="{{ .Title }}">
{{ $commentIcon }}<span class="artalk-comment-count" data-page-key="{{ .RelPermalink }}">-</span>&nbsp;{{ T "single.comments" }}
</span>&nbsp;
{{- else if $comment.valine.enable | and $comment.valine.commentCount -}}
<span class="comment-count" data-flag-title="{{ .Title }}">
{{ $commentIcon }}<span data-xid="{{ .RelPermalink }}" class="valine-comment-count">-</span>&nbsp;{{ T "single.comments" }}
</span>&nbsp;
{{- else if $comment.waline.enable | and $comment.waline.comment -}}
<span class="comment-count" data-flag-title="{{ .Title }}">
{{ $commentIcon }}<span data-path="{{ .RelPermalink }}" class="waline-comment-count">-</span>&nbsp;{{ T "single.comments" }}
</span>&nbsp;
{{- else if $comment.twikoo.enable | and $comment.twikoo.commentCount -}}
<span id="{{ .RelPermalink }}" class="comment-count" data-flag-title="{{ .Title }}">
{{ $commentIcon }}<span id="twikoo-comment-count">-</span>&nbsp;{{ T "single.comments" }}
</span>&nbsp;
{{- end -}}
{{- end -}}
</div>
</div>
{{- /* Featured image */ -}}
{{- $image := $params.featuredimage -}}
{{- with .Resources.GetMatch "featured-image" -}}
{{- $image = .RelPermalink -}}
{{- end -}}
{{- with $image -}}
<div class="featured-image">
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
</div>
{{- end -}}
{{- /* Static TOC */ -}}
{{- if (ne $toc.enable false) | and (ne $tocEmpty true) -}}
<div class="details toc{{ with $params.password }} d-none{{ end }}" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ else }}false{{ end }}">
<div class="details-summary toc-title">
<span>{{ T "single.contents" }}</span>
<span>{{ dict "Class" "details-icon fa-solid fa-angle-right" | partial "plugin/icon.html" }}</span>
</div>
<div class="details-content toc-content" id="toc-content-static">
{{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
</div>
</div>
{{- end -}}
{{- /* Content */ -}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- if $params.password -}}
{{- $saltLen := strings.RuneCount (trim $params.password "") -}}
{{- $saltLen = cond (eq (mod $saltLen 2) 0) (add $saltLen 1) $saltLen -}}
{{- $base64EncodeContent := $content | base64Encode -}}
{{- $content = printf "%v%v%v"
(substr $base64EncodeContent 0 $saltLen)
(substr (sha256 $params.password) $saltLen)
(substr $base64EncodeContent $saltLen)
-}}
{{- end -}}
<div class="content" id="content"
{{- with $params.endFlag }} data-end-flag="{{ . }}"{{- end -}}
{{- with $params.password }} data-password="{{ md5 . }}"{{- end -}}
{{- with $params.password }} data-content="{{ $content }}"{{- end -}}
>
{{- if not $params.password -}}
{{- /* Expiration Reminder */ -}}
{{- partial "single/expiration-reminder.html" . -}}
{{- $content -}}
{{- else -}}
{{- partial "single/fixit-decryptor.html" . -}}
{{- end -}}
</div>
{{- partial "single/newsletter.html" . -}}
{{- /* Footer and Reward */ -}}
{{- $reward := .Scratch.Get "reward" -}}
{{- if eq $reward.position "before" -}}
{{- partial "single/reward.html" . -}}
{{- partial "single/footer.html" . -}}
{{- else -}}
{{- partial "single/footer.html" . -}}
{{- partial "single/reward.html" . -}}
{{- end -}}
{{- /* Comment */ -}}
{{- partial "single/comment.html" . -}}
</article>
{{- end -}}

View File

@ -0,0 +1,214 @@
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}
{{- $toc := .Scratch.Get "toc" -}}
<aside class="toc" id="toc-auto">
{{- /* Auto TOC */ -}}
{{- $tocEmpty := eq .TableOfContents `<nav id="TableOfContents"></nav>` -}}
{{- if (ne $toc.enable false) | and (ne $tocEmpty true) -}}
<h2 class="toc-title{{ with $params.password }} d-none{{ end }}">
{{- T "single.contents" -}}&nbsp;
{{- dict "Class" "toc-icon fa-solid fa-angle-down fa-fw" | partial "plugin/icon.html" -}}
</h2>
<div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}{{ with $params.password }} d-none{{ end }}" id="toc-content-auto"></div>
{{- end -}}
</aside>
<aside class="aside-custom">
<!-- put aside for later use -->
{{- partial (.Scratch.Get "customFilePath").aside . -}}
</aside>
<article class="page single">
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__flipInX">
{{- $repost := $params.repost | default dict -}}
{{- with $repost -}}
{{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share fa-fw" -}}
{{- $title := cond (hasPrefix .Url "http") (printf "%v -> %v" (T "single.repost") .Url ) (T "single.repost") -}}
{{- if hasPrefix .Url "http" -}}
{{ dict "Destination" .Url "Icon" $icon "Class" "icon-repost" "Title" $title | partial "plugin/link.html" -}}
{{- else -}}
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
{{- end -}}
{{- end -}}
{{- end -}}
<span>{{- .Title -}}</span>
</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . }}</p>{{- end -}}
</div>
{{- /* Meta */ -}}
<div class="post-meta">
<div class="post-meta-line">
{{- partial "single/post-author.html" . -}}
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (printf `<a href="%v">%v %v</a>` (partial "function/escapeurl.html" $category.RelPermalink) (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&ensp;" }}
<span class="post-category">
{{- dict "Categories" . | T "single.includedInCategories" | safeHTML -}}
</span>
{{- end -}}
</div>
<div class="post-meta-line">
{{- with .Site.Params.dateformat | default "2006-01-02" | .PublishDate.Format -}}
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | $.PublishDate.Format) | T "single.publishedOnDate" }}">
{{- dict "Class" "fa-regular fa-calendar-alt fa-fw me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
</span>&nbsp;
{{- end -}}
{{- with .Site.Params.dateformat | default "2006-01-02" | .Lastmod.Format -}}
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | $.Lastmod.Format) | T "single.updatedOnDate" }}">
{{- dict "Class" "fa-regular fa-edit fa-fw me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
</span>&nbsp;
{{- end -}}
{{- if $params.wordCount -}}
<span>
{{- dict "Class" "fa-solid fa-pencil-alt fa-fw me-1" | partial "plugin/icon.html" -}}
{{- T "single.wordCount" .WordCount -}}
</span>&nbsp;
{{- end -}}
{{- if $params.readingTime -}}
<span>
{{- dict "Class" "fa-regular fa-clock fa-fw me-1" | partial "plugin/icon.html" -}}
{{- T "single.readingTime" .ReadingTime -}}
</span>&nbsp;
{{- end -}}
{{- /* If the article expires, close the comment or not */ -}}
{{- $expirationReminder := $params.expirationReminder | default dict -}}
{{- if
$expirationReminder.enable
| and (gt (div (sub now.Unix .Lastmod.Unix) 86400) ($expirationReminder.warning | default 180))
| and $expirationReminder.closeComment -}}
{{- .Scratch.Set "commentExpired" true -}}
{{- end -}}
{{- $comment := .Scratch.Get "comment" | default dict -}}
{{- $visitorIcon := dict "Class" "fa-regular fa-eye fa-fw me-1" | partial "plugin/icon.html" -}}
{{- $commentIcon := dict "Class" "fa-regular fa-comments fa-fw me-1" | partial "plugin/icon.html" -}}
{{- /* Visitor Count */ -}}
{{- if $comment.enable -}}
{{- if $comment.artalk.enable -}}
<span class="comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span class="artalk-visitor-count" data-page-key="{{ .RelPermalink }}">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if ($comment.valine.enable | and $comment.valine.visitor) -}}
<span id="{{ .RelPermalink }}" class="leancloud_visitors comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span class="leancloud-visitors-count">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if $comment.waline.enable | and $comment.waline.pageview -}}
<span class="comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span data-path="{{ .RelPermalink }}" class="waline-pageview-count">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if $comment.twikoo.enable | and $comment.twikoo.visitor -}}
<span id="{{ .RelPermalink }}" class="comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span id="twikoo_visitors">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if .Site.Params.ibruce.enable | and .Site.Params.ibruce.enablePost -}}
<span id="busuanzi_container_page_pv" class="busuanzi_visitors comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span id="busuanzi_value_page_pv">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- end -}}
{{- else if .Site.Params.ibruce.enable | and .Site.Params.ibruce.enablePost -}}
<span id="busuanzi_container_page_pv" class="busuanzi_visitors comment-visitors" data-flag-title="{{ .Title }}">
{{ $visitorIcon }}<span id="busuanzi_value_page_pv">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- end -}}
{{- /* Comment Count */ -}}
{{- if $comment.enable -}}
{{- if $comment.artalk.enable -}}
<span class="comment-count" data-flag-title="{{ .Title }}">
{{ $commentIcon }}<span class="artalk-comment-count" data-page-key="{{ .RelPermalink }}">-</span>&nbsp;{{ T "single.comments" }}
</span>&nbsp;
{{- else if $comment.valine.enable | and $comment.valine.commentCount -}}
<span class="comment-count" data-flag-title="{{ .Title }}">
{{ $commentIcon }}<span data-xid="{{ .RelPermalink }}" class="valine-comment-count">-</span>&nbsp;{{ T "single.comments" }}
</span>&nbsp;
{{- else if $comment.waline.enable | and $comment.waline.comment -}}
<span class="comment-count" data-flag-title="{{ .Title }}">
{{ $commentIcon }}<span data-path="{{ .RelPermalink }}" class="waline-comment-count">-</span>&nbsp;{{ T "single.comments" }}
</span>&nbsp;
{{- else if $comment.twikoo.enable | and $comment.twikoo.commentCount -}}
<span id="{{ .RelPermalink }}" class="comment-count" data-flag-title="{{ .Title }}">
{{ $commentIcon }}<span id="twikoo-comment-count">-</span>&nbsp;{{ T "single.comments" }}
</span>&nbsp;
{{- end -}}
{{- end -}}
</div>
</div>
{{- /* Featured image */ -}}
{{- $image := $params.featuredimage -}}
{{- with .Resources.GetMatch "featured-image" -}}
{{- $image = .RelPermalink -}}
{{- end -}}
{{- with $image -}}
<div class="featured-image">
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
</div>
{{- end -}}
{{- /* Static TOC */ -}}
{{- if (ne $toc.enable false) | and (ne $tocEmpty true) -}}
<div class="details toc{{ with $params.password }} d-none{{ end }}" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ else }}false{{ end }}">
<div class="details-summary toc-title">
<span>{{ T "single.contents" }}</span>
<span>{{ dict "Class" "details-icon fa-solid fa-angle-right" | partial "plugin/icon.html" }}</span>
</div>
<div class="details-content toc-content" id="toc-content-static">
{{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
</div>
</div>
{{- end -}}
{{- /* Content */ -}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- if $params.password -}}
{{- $saltLen := strings.RuneCount (trim $params.password "") -}}
{{- $saltLen = cond (eq (mod $saltLen 2) 0) (add $saltLen 1) $saltLen -}}
{{- $base64EncodeContent := $content | base64Encode -}}
{{- $content = printf "%v%v%v"
(substr $base64EncodeContent 0 $saltLen)
(substr (sha256 $params.password) $saltLen)
(substr $base64EncodeContent $saltLen)
-}}
{{- end -}}
<div class="content" id="content"
{{- with $params.endFlag }} data-end-flag="{{ . }}"{{- end -}}
{{- with $params.password }} data-password="{{ md5 . }}"{{- end -}}
{{- with $params.password }} data-content="{{ $content }}"{{- end -}}
>
{{- if not $params.password -}}
{{- /* Expiration Reminder */ -}}
{{- partial "single/expiration-reminder.html" . -}}
{{- $content -}}
{{- else -}}
{{- partial "single/fixit-decryptor.html" . -}}
{{- end -}}
</div>
{{- /* Footer and Reward */ -}}
{{- $reward := .Scratch.Get "reward" -}}
{{- if eq $reward.position "before" -}}
{{- partial "single/reward.html" . -}}
{{- partial "single/footer.html" . -}}
{{- else -}}
{{- partial "single/footer.html" . -}}
{{- partial "single/reward.html" . -}}
{{- end -}}
{{- /* Comment */ -}}
{{- partial "single/comment.html" . -}}
</article>
{{- end -}}

View File

@ -0,0 +1,68 @@
User-agent: *
Disallow: /images/
Disallow: /js/
Disallow: /css/
Disallow: /*offline/
Disallow: /*404.html$
Disallow: /*.md$
User-agent: MJ12bot
Disallow: /
User-agent: AhrefsBot
Disallow: /
User-agent: BLEXBot
Disallow: /
# Block SISTRIX
User-agent: SISTRIX Crawler
Disallow: /
User-agent: sistrix
Disallow: /
User-agent: 007ac9
Disallow: /
User-agent: 007ac9 Crawler
Disallow: /
# Block Uptime robot
User-agent: UptimeRobot/2.0
Disallow: /
# Block Ezooms Robot
User-agent: Ezooms Robot
Disallow: /
# Block Perl LWP
User-agent: Perl LWP
Disallow: /
# Block netEstate NE Crawler (+http://www.website-datenbank.de/)
User-agent: netEstate NE Crawler (+http://www.website-datenbank.de/)
Disallow: /
# Block WiseGuys Robot
User-agent: WiseGuys Robot
Disallow: /
# Block Turnitin Robot
User-agent: Turnitin Robot
Disallow: /
# Block Heritrix
User-agent: Heritrix
Disallow: /
# Block pricepi
User-agent: pimonster
Disallow: /
User-agent: SurdotlyBot
Disallow: /
User-agent: ZoominfoBot
Disallow: /
Sitemap: {{ "/sitemap.xml" | absURL }}

View File

@ -0,0 +1,41 @@
{{- $inner := .Inner | .Page.RenderString -}}
{{- $iconMap := dict "note" "fa-solid fa-pencil-alt fa-fw" -}}
{{- $iconMap = dict "abstract" "fa-solid fa-list-ul fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "info" "fa-solid fa-info-circle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "tip" "fa-solid fa-lightbulb fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "success" "fa-solid fa-check-circle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "question" "fa-solid fa-question-circle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "warning" "fa-solid fa-exclamation-triangle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "failure" "fa-solid fa-times-circle fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "danger" "fa-solid fa-skull-crossbones fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "bug" "fa-solid fa-bug fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "example" "fa-solid fa-list-ol fa-fw" | merge $iconMap -}}
{{- $iconMap = dict "quote" "fa-solid fa-quote-right fa-fw" | merge $iconMap -}}
{{- $iconDetails := "fa-solid fa-angle-right fa-fw" -}}
{{- if .IsNamedParams -}}
{{- $type := .Get "type" | default "note" -}}
<div class="details admonition {{ $type }}{{ if .Get `open` | ne false }} open{{ end }}">
<div class="details-summary admonition-title">
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}" aria-hidden="true"></i>{{ .Get "title" | .Page.RenderString | default (T (printf "admonition.%v" $type)) }}<i class="details-icon {{ $iconDetails }}" aria-hidden="true"></i>
</div>
<div class="details-content">
<div class="admonition-content">
{{- $inner -}}
</div>
</div>
</div>
{{- else -}}
{{- $type := .Get 0 | default "note" -}}
<div class="details admonition {{ $type }}{{ if .Get 2 | ne false }} open{{ end }}">
<div class="details-summary admonition-title">
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}" aria-hidden="true"></i>{{ .Get 1 | .Page.RenderString | default (T (printf "admonition.%v" $type)) }}<i class="details-icon {{ $iconDetails }}" aria-hidden="true"></i>
</div>
<div class="details-content">
<div class="admonition-content">
{{- $inner -}}
</div>
</div>
</div>
{{- end -}}

View File

@ -0,0 +1,8 @@
<div class="bilibili">
{{- if .IsNamedParams -}}
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get `id` }}&page={{ .Get `p` | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
{{- else -}}
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get 0 }}&page={{ .Get 1 | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
{{- end -}}
</div>
{{- /* EOF */ -}}

View File

@ -0,0 +1,4 @@
<blockquote class="blockquote-center">
{{ .Inner | .Page.RenderString }}
</blockquote>
{{- /* EOF */ -}}

View File

@ -0,0 +1,5 @@
<details>
<summary>{{ .Get "summary" | default (.Get 0) | .Page.RenderString }}</summary>
{{ .Inner | .Page.RenderString }}
</details>
{{- /* EOF */ -}}

View File

@ -0,0 +1,6 @@
{{- $content := .Inner | transform.Unmarshal | jsonify -}}
{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}}
{{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}}
{{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}}
<div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
{{- .Page.Scratch.SetInMap "this" "echarts" true -}}

View File

@ -0,0 +1,34 @@
{{- $password := "" -}}
{{- $message := "" -}}
{{- if .IsNamedParams -}}
{{- $password = .Get "password" | default "" -}}
{{- $message = .Get "message" | default (T "single.encryptedMessage") -}}
{{- else -}}
{{- $password = .Get 0 | default "" -}}
{{- $message = .Get 1 | default (T "single.encryptedMessage") -}}
{{- end -}}
{{- if $password -}}
{{- $content := .Inner | .Page.RenderString -}}
{{- $saltLen := strings.RuneCount (trim $password "") -}}
{{- $saltLen = cond (eq (mod $saltLen 2) 0) (add $saltLen 1) $saltLen -}}
{{- $base64EncodeContent := $content | base64Encode -}}
{{- $content = printf "%v%v%v"
(substr $base64EncodeContent 0 $saltLen)
(substr (sha256 $password) $saltLen)
(substr $base64EncodeContent $saltLen)
-}}
<fixit-encryptor class="fixit-encryptor-shortcode">
<div class="fixit-decryptor-container">
<label title='{{ T "single.password" }}'>
<input type="password" class="fixit-decryptor-input" placeholder="🔑 {{ $message }}" />
</label>
</div>
<div data-password="{{ md5 $password }}" data-content="{{ $content }}"></div>
</fixit-encryptor>
{{- .Page.Scratch.SetInMap "this" "encryptPartial" true -}}
{{- else -}}
{{- .Inner -}}
{{- end -}}

View File

@ -0,0 +1,30 @@
{{- $options := cond .IsNamedParams (.Get "src") (.Get 0) | dict "Src" -}}
{{- $options = cond .IsNamedParams (.Get "alt") (.Get 1) | .Page.RenderString | dict "Alt" | merge $options -}}
{{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}}
{{- $options = dict "Caption" $caption | merge $options -}}
{{- if .IsNamedParams -}}
{{- $options = dict "Title" (.Get "title") | merge $options -}}
{{- $options = dict "SrcSmall" (.Get "src_s") | merge $options -}}
{{- $options = dict "SrcLarge" (.Get "src_l") | merge $options -}}
{{- $options = dict "Height" (.Get "height") | merge $options -}}
{{- $options = dict "Width" (.Get "width") | merge $options -}}
{{- $options = .Get "linked" | ne false | dict "Linked" | merge $options -}}
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
{{- $options = dict "Loading" (.Get "loading") | merge $options -}}
{{- else -}}
{{- $options = cond $caption true false | dict "Linked" | merge $options -}}
{{- end -}}
{{- $options = dict "Resources" .Page.Resources | merge $options -}}
{{- with $caption -}}
<figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}>
{{- partial "plugin/image.html" $options -}}
<figcaption class="image-caption">
{{- . | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- partial "plugin/image.html" $options -}}
{{- end -}}

View File

@ -0,0 +1,20 @@
{{- $destination := cond .IsNamedParams (.Get "href") (.Get 0) -}}
{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}}
{{- $destination = .RelPermalink -}}
{{- end -}}
{{- $options := dict "Destination" $destination -}}
{{- if .IsNamedParams -}}
{{- $options = dict "Content" (.Get "content") | merge $options -}}
{{- $options = dict "Title" (.Get "title") | merge $options -}}
{{- $options = dict "Class" (.Get "class") | merge $options -}}
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
{{- $options = dict "Download" (.Get "download") | merge $options -}}
{{- $options = dict "Card" (.Get "card") | merge $options -}}
{{- $options = dict "Noreferrer" (.Get "noreferrer") | merge $options -}}
{{- else -}}
{{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}}
{{- $options = dict "Title" (.Get 2) | merge $options -}}
{{- $options = dict "Card" (.Get 3) | merge $options -}}
{{- end -}}
{{- $options = dict "ExternalIcon" (.Get "external-icon" | default .Site.Params.externalIcon ) | merge $options -}}
{{- partial "plugin/link.html" $options -}}

View File

@ -0,0 +1,33 @@
{{- $mapbox := (.Page.Scratch.Get "params").mapbox | default dict -}}
{{- $lng := cond .IsNamedParams (.Get "lng") (.Get 0) -}}
{{- $lat := cond .IsNamedParams (.Get "lat") (.Get 1) -}}
{{- $zoom := cond .IsNamedParams (.Get "zoom") (.Get 2) | default 10 -}}
{{- $marked := cond .IsNamedParams (.Get "marked") (.Get 3) | ne false -}}
{{- $lightStyle := $mapbox.lightStyle -}}
{{- $darkStyle := $mapbox.darkStyle -}}
{{- $navigation := $mapbox.navigation -}}
{{- $geolocate := $mapbox.geolocate -}}
{{- $scale := $mapbox.scale -}}
{{- $fullscreen := $mapbox.fullscreen -}}
{{- $width := "100%" -}}
{{- $height := "20rem" -}}
{{- if .IsNamedParams -}}
{{- $lightStyle = .Get "light-style" | default $lightStyle -}}
{{- $darkStyle = .Get "dark-style" | default $darkStyle -}}
{{- $navigation = .Get "navigation" | ne false | and $navigation -}}
{{- $geolocate = .Get "geolocate" | ne false | and $geolocate -}}
{{- $scale = .Get "scale" | ne false | and $scale -}}
{{- $fullscreen = .Get "fullscreen" | ne false | and $fullscreen -}}
{{- $width = .Get "width" | default $width -}}
{{- $height = .Get "height" | default $height -}}
{{- else -}}
{{- $lightStyle = .Get 4 | default $lightStyle -}}
{{- $darkStyle = .Get 5 | default $darkStyle -}}
{{- end -}}
{{- $darkStyle = $darkStyle | default $lightStyle -}}
{{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen -}}
{{- $id := dict "Content" $options "Scratch" .Page.Scratch | partial "function/id.html" -}}
<div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
{{- .Page.Scratch.SetInMap "this" "mapbox" true -}}

View File

@ -0,0 +1,3 @@
{{- $id := dict "Content" (trim (partial "function/dos2unix.html" .Inner) "\n") "Scratch" .Page.Scratch | partial "function/id.html" -}}
<div class="mermaid" id="{{ $id }}"></div>
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}}

View File

@ -0,0 +1,50 @@
{{- $theme := "#448aff" -}}
{{- if .IsNamedParams -}}
{{- $theme = .Get "theme" | default $theme -}}
{{- if .Get "url" -}}
{{- $url := .Get "url" -}}
{{- with dict "Path" $url "Resources" .Page.Resources | partial "function/resource.html" -}}
{{- $url = .RelPermalink -}}
{{- end -}}
{{- $cover := .Get "cover" -}}
{{- with dict "Path" $cover "Resources" .Page.Resources | partial "function/resource.html" -}}
{{- $cover = .RelPermalink -}}
{{- end -}}
<meting-js url="{{ $url }}" name="{{ .Get `name` }}" artist="{{ .Get `artist` }}" cover="{{ $cover }}" theme="{{ $theme }}"
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
></meting-js>
{{- else if .Get "auto" -}}
<meting-js auto="{{ .Get `auto` }}" theme="{{ $theme }}"
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
{{- with .Get "loop" }} loop="{{ . }}"{{ end -}}
{{- with .Get "order" }} order="{{ . }}"{{ end -}}
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
{{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}}
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
></meting-js>
{{- else -}}
<meting-js server="{{ .Get `server` }}" type="{{ .Get `type` }}" id="{{ .Get `id` }}" theme="{{ $theme }}"
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
{{- with .Get "loop" }} loop="{{ . }}"{{ end -}}
{{- with .Get "order" }} order="{{ . }}"{{ end -}}
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
{{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}}
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
></meting-js>
{{- end -}}
{{- else if (.Get 0 | urls.Parse).Host -}}
<meting-js auto="{{ .Get 0 }}" theme="{{ $theme }}"></meting-js>
{{- else -}}
<meting-js server="{{ .Get 0 }}" type="{{ .Get 1 }}" id="{{ .Get 2 }}" theme="{{ $theme }}"></meting-js>
{{- end -}}
{{- .Page.Scratch.SetInMap "this" "music" true -}}

View File

@ -0,0 +1,3 @@
{{- $tag := .Get "tag" | default (.Get 0) | default "div" -}}
{{- printf `<%v class="fi-row">%v</%v>` $tag .Inner $tag | safeHTML -}}

View File

@ -0,0 +1,12 @@
{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}}
{{- $wechatpay := (.Get "wechatpay") | default (.Get 0) -}}
{{- $alipay := (.Get "alipay") | default (.Get 1) -}}
{{- $paypal := (.Get "paypal") | default (.Get 2) -}}
{{- $bitcoin := (.Get "bitcoin") | default (.Get 3) -}}
{{- $author := (.Get "author") | default (.Get 4) | default (.Page.Scratch.Get "author").name -}}
{{- $comment := (.Get "comment") | default (.Get 5) -}}
{{- $mode := (.Get "mode") | default (.Get 6) -}}
{{- $reward := dict "enable" true "comment" $comment "mode" $mode -}}
{{- $reward = dict "wechatpay" $wechatpay "alipay" $alipay "paypal" $paypal "bitcoin" $bitcoin | dict "ways" | merge $reward -}}
{{- $options := dict "Reward" $reward "Id" $id "Author" $author -}}
{{- partial "plugin/reward.html" $options -}}

View File

@ -0,0 +1,2 @@
{{- $scriptArr := (.Page.Scratch.Get "this").scriptArr | default slice -}}
{{- $scriptArr | append (trim (partial "function/dos2unix.html" .Inner) "\n") | .Page.Scratch.SetInMap "this" "scriptArr" -}}

View File

@ -0,0 +1,8 @@
{{- $content := .Inner | .Page.RenderString -}}
{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}}
{{- $tag := .Get 1 | default "div" -}}
{{- printf `<%v id="%v">%v</%v>` $tag $id $content $tag | safeHTML -}}
{{- $style := .Get 0 | printf "#%v{%v}" $id -}}
{{- $styleArr := (.Page.Scratch.Get "this").styleArr | default slice -}}
{{- $styleArr | append $style | .Page.Scratch.SetInMap "this" "styleArr" -}}

View File

@ -0,0 +1,39 @@
{{- $content := trim (partial "function/dos2unix.html" .Inner) "\n" -}}
{{- $classList := slice -}}
{{- with .Get "class" -}}
{{- $classList = $classList | append . -}}
{{- end -}}
{{- $tag := .Get "tag" | default "div" -}}
{{- $loop := cond (ne (.Get "group") "") false (.Get "loop") -}}
{{- if .Get "code" -}}
{{- /* highlight code content without line number */ -}}
{{- $content = highlight $content (.Get "code") "lineNos=false, noClasses=false" -}}
{{- /* delete outer label */ -}}
{{- $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 -}}
{{- end -}}
{{- /* trim the newline */ -}}
{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}}
{{- $key := .Get "group" | string | default $id -}}
{{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}}
{{- $group := index $typeitMap $key -}}
{{- $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"{{ if ne $loop "" }} data-loop="{{ $loop }}"{{ end }}>{{ printf `<%v %v></%v>` $tag $attrs $tag | safeHTML }}</div>
{{- /* EOF */ -}}

View File

@ -0,0 +1,14 @@
{{- $version := .Get 0 -}}
{{- $url := printf "https://github.com/hugo-fixit/FixIt/releases/tag/v%v" $version -}}
{{- $type := .Get 1 | default "new" | lower -}}
{{- $label := T (printf "version.%v" $type) -}}
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
{{- $pathTemplate := cond .Site.IsMultiLingual (printf "svg/version/%%v-%%v.%v.svg" .Page.Language.Lang) "svg/version/%v-%v.svg" -}}
{{- $path := printf $pathTemplate $version $type -}}
{{- $resource := resources.Get "svg/version.template.svg" -}}
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color "isCJK" .Page.Params.IsCJKLanguage) | minify -}}
{{- $alt := printf "FixIt %v | %v" $version $label -}}
<a href="{{ $url }}" rel="external nofollow noopener noreferrer" target="_blank">
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
</a>
{{- /* EOF */ -}}

View File

@ -0,0 +1,47 @@
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
>
{{- range (where .Data.Pages "Section" "!=" "gallery") -}}
<url>
<loc>
{{- .Permalink -}}
</loc>
{{- if not .Lastmod.IsZero -}}
<lastmod>
{{- .Lastmod.Format "2006-01-02T15:04:05-07:00" -}}
</lastmod>
{{- end -}}
{{- with .Sitemap.ChangeFreq -}}
<changefreq>
{{- . -}}
</changefreq>
{{- end -}}
{{- if ge .Sitemap.Priority 0.0 -}}
{{- $weeks := div (sub now.Unix .Lastmod.Unix) 604800 -}}
{{- $priority := sub 1 (div $weeks 10.0 ) -}}
{{- if ge .Sitemap.Priority $priority -}}
<priority>{{ .Sitemap.Priority }}</priority>
{{- else -}}
<priority>{{ $priority }}</priority>
{{- end -}}
{{- end -}}
{{- if .IsTranslated -}}
{{- range .Translations -}}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>
{{- end -}}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>
{{- end -}}
</url>
{{- end -}}
</urlset>

View File

@ -0,0 +1,43 @@
{{- define "title" -}}
{{- .Title | title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}
<div class="page archive">
{{- /* Title */ -}}
<h2 class="single-title animate__animated animate__pulse animate__faster">
{{- $taxonomy := .Data.Singular -}}
{{- $pageCount := len .Pages -}}
{{- if eq $taxonomy "category" -}}
{{ dict "Class" "fa-regular fa-folder-open fa-fw" | partial "plugin/icon.html" }}
{{ .Title | title }}&nbsp;<sup>{{- $pageCount -}}</sup>
{{- else if eq $taxonomy "tag" -}}
{{ dict "Class" "fa-solid fa-tag fa-fw" | partial "plugin/icon.html" }}
{{ .Title | title }}&nbsp;<sup>{{- $pageCount -}}</sup>
{{- else -}}
{{- printf "%v - %v " (T $taxonomy | default $taxonomy) .Title | title -}}
{{- end -}}
</h2>
{{- /* Paginate */ -}}
{{- if .Pages -}}
{{- $pages := .Pages.GroupByDate "2006" -}}
{{- with .Site.Params.list.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}}
{{- else -}}
{{- $pages = .Paginate $pages -}}
{{- end -}}
{{- range $pages.PageGroups -}}
<h3 class="group-title">{{ .Key }}</h3>
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<span class="archive-item-date" title={{ "2006-01-02 15:04:05" | .Date.Format }}>
{{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}}
</span>
</article>
{{- end -}}
{{- end -}}
{{- partial "paginator.html" . -}}
{{- end -}}
</div>
{{- end -}}

View File

@ -0,0 +1,41 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
</title>
<link>
{{- .Permalink -}}
</link>
<description>
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
</description>
<generator>Hugo -- gohugo.io</generator>
{{- with .Site.LanguageCode -}}
<language>
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
<copyright>
{{- . -}}
</copyright>
{{- end -}}
{{- if not .Date.IsZero -}}
<lastBuildDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</lastBuildDate>
{{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- range .Pages | first (.Site.Params.list.rss | default 10) -}}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>

View File

@ -0,0 +1,101 @@
{{- define "title" -}}
{{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "allSome" }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}
{{- $taxonomies := .Data.Plural -}}
{{- $terms := .Data.Terms.ByCount -}}
{{- $type := .Type -}}
<div class="page archive">
{{- /* Title */ -}}
<h2 class="single-title animate__animated animate__pulse animate__faster">
{{- .Params.Title | default (T $taxonomies) | default $taxonomies | humanize | dict "Some" | T "allSome" | title }}
<sup>{{- len $terms -}}</sup>
</h2>
{{- /* Categories Page */ -}}
{{- if eq $taxonomies "categories" -}}
<div class="categories-card">
{{- range $terms -}}
{{- $term := .Term -}}
{{- $pages := .Pages -}}
{{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $type $term) -}}
<div class="card-item">
<div class="card-item-wrapper">
<h3 class="card-item-title">
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}'>
{{ dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html" }}
{{ .Page.Title }}&nbsp;<sup>{{- len $pages -}}</sup>
</a>
</h3>
{{- range first 5 $pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
</article>
{{- end -}}
{{- if gt (len $pages) 5 -}}
<span class="more-post">
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="more-single-link">{{ T "pagination.more" }} >></a>
</span>
{{- end -}}
</div>
</div>
{{- end -}}
{{- end -}}
</div>
{{- /* Tag Cloud Page */ -}}
{{- else if eq $taxonomies "tags" -}}
{{- $tagCloud := .Site.Params.tagcloud -}}
<div class="tag-cloud-tags{{ with $tagCloud.enable }} text-center{{ end }}">
{{- if $tagCloud.enable -}}
{{- $tags := cond (eq $tagCloud.orderby "name") $.Site.Taxonomies.tags.Alphabetical $.Site.Taxonomies.tags.ByCount -}}
{{- $baseGrade := div ($tagCloud.peakCount | default 10) 10.0 -}}
{{- $minFont := $tagCloud.min | default 16 -}}
{{- $baseFont := div (sub ($tagCloud.max | default 32) $minFont) 10.0 -}}
{{- range $tags -}}
{{- $grade := math.Min (math.Floor (div (sub .Count 1) $baseGrade)) 10 -}}
{{- $fontSize := add $minFont (mul $grade $baseFont) -}}
<a href='{{ partial "function/escapeurl.html" .Page.RelPermalink }}' class="tag-cloud-{{ $grade }}" style="--tag-font: {{ $fontSize }}px">{{ .Page.Title }} <sup>{{ .Count }}</sup></a>
{{- end -}}
{{- else -}}
{{- range $.Site.Taxonomies.tags.ByCount -}}
<a href='{{ partial "function/escapeurl.html" .Page.RelPermalink }}'>{{ .Page.Title }} <sup>{{ .Count }}</sup></a>
{{- end -}}
{{- end -}}
</div>
{{- else}}
{{- /* Taxonomies Page */ -}}
<div class="categories-card">
{{- range $terms -}}
{{- $term := .Term -}}
{{- $pages := .Pages -}}
{{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $type $term) -}}
<div class="card-item">
<div class="card-item-wrapper">
<h3 class="card-item-title">
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}'>
{{ dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html" }}
{{ .Page.Title | title }}&nbsp;<sup>{{- len $pages -}}</sup>
</a>
</h3>
{{- range first 5 $pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
</article>
{{- end -}}
{{- if gt (len $pages) 5 -}}
<span class="more-post">
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="more-single-link">{{ T "pagination.more" }} >></a>
</span>
{{- end -}}
</div>
</div>
{{- end -}}
{{- end -}}
</div>
{{- end -}}
</div>
{{- end -}}

View File

@ -0,0 +1,70 @@
{{- define "title" -}}
{{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "allSome" }} - {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}}
{{- $taxonomies := .Data.Plural -}}
{{- $terms := .Data.Terms.ByCount -}}
{{- $type := .Type -}}
<div class="page archive">
{{- /* Title */ -}}
<h2 class="single-title animate__animated animate__pulse animate__faster">
{{- .Params.Title | default (T $taxonomies) | default $taxonomies | dict "Some" | T "allSome" }}
<sup>{{- len $terms -}}</sup>
</h2>
{{- /* Categories Page */ -}}
{{- if eq $taxonomies "categories" -}}
<div class="categories-card">
{{- range $terms -}}
{{- $term := .Term -}}
{{- $pages := .Pages -}}
{{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $type $term) -}}
<div class="card-item">
<div class="card-item-wrapper">
<h3 class="card-item-title">
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}'>
{{ dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html" }}
{{ .Page.Title }}&nbsp;<sup>{{- len $pages -}}</sup>
</a>
</h3>
{{- range first 5 $pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
</article>
{{- end -}}
{{- if gt (len $pages) 5 -}}
<span class="more-post">
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="more-single-link">{{ T "pagination.more" }} >></a>
</span>
{{- end -}}
</div>
</div>
{{- end -}}
{{- end -}}
</div>
{{- /* Tag Cloud Page */ -}}
{{- else if eq $taxonomies "tags" -}}
{{- $tagCloud := .Site.Params.tagcloud -}}
<div class="tag-cloud-tags{{ with $tagCloud.enable }} text-center{{ end }}">
{{- if $tagCloud.enable -}}
{{- $tags := cond (eq $tagCloud.orderby "name") $.Site.Taxonomies.tags.Alphabetical $.Site.Taxonomies.tags.ByCount -}}
{{- $baseGrade := div ($tagCloud.peakCount | default 10) 10.0 -}}
{{- $minFont := $tagCloud.min | default 16 -}}
{{- $baseFont := div (sub ($tagCloud.max | default 32) $minFont) 10.0 -}}
{{- range $tags -}}
{{- $grade := math.Min (math.Floor (div (sub .Count 1) $baseGrade)) 10 -}}
{{- $fontSize := add $minFont (mul $grade $baseFont) -}}
<a href='{{ partial "function/escapeurl.html" .Page.RelPermalink }}' class="tag-cloud-{{ $grade }}" style="--tag-font: {{ $fontSize }}px">{{ .Page.Title }} <sup>{{ .Count }}</sup></a>
{{- end -}}
{{- else -}}
{{- range $.Site.Taxonomies.tags.ByCount -}}
<a href='{{ partial "function/escapeurl.html" .Page.RelPermalink }}'>{{ .Page.Title }} <sup>{{ .Count }}</sup></a>
{{- end -}}
{{- end -}}
</div>
{{- end -}}
</div>
{{- end -}}