feat: improve configuration (#245)
* feat: improve configuration * fix: fix partials/footer.html error
This commit is contained in:
@@ -1,20 +1,26 @@
|
||||
{{- $scratch := newScratch -}}
|
||||
{{- .Scratch.Set "scratch" $scratch -}}
|
||||
{{- if eq hugo.Environment "production" -}}
|
||||
{{- $scratch.Set "CDN" .Site.Params.cdn -}}
|
||||
{{- $scratch.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $scratch.Set "major-version" "0.2.X" -}}
|
||||
{{- $scratch.Set "version" "0.2.0" -}}
|
||||
{{- $version := "0.2.X" -}}
|
||||
|
||||
{{- /* LoveIt theme version detection */ -}}
|
||||
{{- if not .Site.Params.version -}}
|
||||
{{- errorf "\n\nYou haven't configured the LoveIt version param correctly yet. See https://hugoloveit.com/theme-documentation-basics/#basic-configuration \n你还没有正确配置 LoveIt 的版本参数 参考 https://hugoloveit.com/zh-cn/theme-documentation-basics/#basic-configuration \n" -}}
|
||||
{{- else if ne .Site.Params.version ($scratch.Get "major-version") -}}
|
||||
{{- errorf (printf "\n\n%s -> %s:\nYou have an incompatible update. See https://github.com/dillonzq/LoveIt/releases \n你进行了一次不兼容的更新 参考 https://github.com/dillonzq/LoveIt/releases \n" .Site.Params.version ($scratch.Get "major-version")) -}}
|
||||
{{- else if ne .Site.Params.version $version -}}
|
||||
{{- errorf (printf "\n\n%s -> %s:\nYou have an incompatible update. See https://github.com/dillonzq/LoveIt/releases \n你进行了一次不兼容的更新 参考 https://github.com/dillonzq/LoveIt/releases \n" .Site.Params.version $version) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $params := .Params | merge .Site.Params.page -}}
|
||||
{{- .Scratch.Set "version" "0.2.0" -}}
|
||||
|
||||
{{- if eq hugo.Environment "production" -}}
|
||||
{{- .Scratch.Set "cdn" .Site.Params.cdn -}}
|
||||
{{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- else -}}
|
||||
{{- $params = dict "comment" nil | merge $params -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- .Scratch.Set "params" $params -}}
|
||||
{{- $this := dict "desktop" .Site.Params.header.desktopMode "mobile" .Site.Params.header.mobileMode | dict "headerMode" | dict "config" -}}
|
||||
{{- .Scratch.Set "this" $this -}}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.LanguageCode }}">
|
||||
<head>
|
||||
@@ -25,7 +31,7 @@
|
||||
<title>
|
||||
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
|
||||
</title>
|
||||
<meta name="Description" content="{{ .Params.description | default .Site.Params.description }}">
|
||||
<meta name="Description" content="{{ $params.description | default .Site.Params.description }}">
|
||||
|
||||
{{- partial "head/meta.html" . -}}
|
||||
{{- partial "head/link.html" . -}}
|
||||
@@ -33,8 +39,8 @@
|
||||
</head>
|
||||
<body>
|
||||
{{- /* Check theme isDark before body rendering */ -}}
|
||||
{{- $theme := .Site.Params.defaultTheme -}}
|
||||
<script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ .Site.Params.defaultTheme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ .Site.Params.defaultTheme }}' === 'dark')) && document.body.classList.add('dark');</script>
|
||||
{{- $theme := .Site.Params.defaulttheme -}}
|
||||
<script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.classList.add('dark');</script>
|
||||
|
||||
<div id="mask"></div>
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
</h2>
|
||||
|
||||
{{- /* Paginate */ -}}
|
||||
{{- range (.Paginate (.Pages.GroupByDate "2006")).PageGroups -}}
|
||||
{{- $pages := .Pages.GroupByDate "2006" -}}
|
||||
{{- range (.Site.Params.section.paginate | default .Site.Params.paginate | .Paginate $pages).PageGroups -}}
|
||||
<h3>{{ .Key }}</h3>
|
||||
{{- range .Pages -}}
|
||||
<article class="archive-item">
|
||||
@@ -18,7 +19,7 @@
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
<span class="archive-item-date">
|
||||
{{- .Date.Format (.Site.Params.dateFormatToUse | default "01-02") -}}
|
||||
{{- .Date.Format ($.Site.Params.section.dateFormat | default "01-02") -}}
|
||||
</span>
|
||||
</article>
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
<div class="page single special">
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title animated pulse faster">
|
||||
{{- .Title -}}
|
||||
</h1>
|
||||
{{- with .Params.subtitle -}}
|
||||
|
||||
{{- /* Subtitle */ -}}
|
||||
{{- with $params.subtitle -}}
|
||||
<h2 class="single-subtitle">{{ . }}</h2>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Content */ -}}
|
||||
<div class="content" id="content">
|
||||
{{- partial "function/content.html" .Content | safeHTML -}}
|
||||
{{- dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
{{- $scratch := .Scratch.Get "scratch" -}}
|
||||
|
||||
{{- $params := .Params | merge .Site.Params.page -}}
|
||||
<article class="single summary" itemscope itemtype="http://schema.org/Article">
|
||||
{{- /* Featured image */ -}}
|
||||
{{- with .Params.featuredImage -}}
|
||||
{{- with $params.featuredimage -}}
|
||||
<div class="featured-image-preview">
|
||||
{{- $image := $.Params.featuredImagePreview | default . -}}
|
||||
{{- $image := $params.featuredimagepreview | default . -}}
|
||||
{{- partial "plugin/image.html" (dict "src" $image "alt" $.Description "large" true) -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
@@ -16,19 +15,19 @@
|
||||
|
||||
{{- /* Meta */ -}}
|
||||
<div class="post-meta">
|
||||
{{- $author := .Params.author | default .Site.Author.name | default (T "author") -}}
|
||||
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
|
||||
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
|
||||
{{- $authorLink := $params.authorlink | default .Site.Author.link | default (relLangURL "/") -}}
|
||||
<span class="post-author">
|
||||
{{- $options := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
</span>
|
||||
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormat | default "2006-01-02") -}}
|
||||
<span class="post-publish">
|
||||
{{ T "publish" }} <time datetime={{ $publish_date }}>{{ $publish_date }}</time>
|
||||
</span>
|
||||
|
||||
{{- with .Params.categories -}}
|
||||
{{- with $params.categories -}}
|
||||
|
||||
<span class="post-category">
|
||||
{{- T "included" -}}
|
||||
@@ -45,7 +44,7 @@
|
||||
{{- /* Summary content */ -}}
|
||||
<div class="content">
|
||||
{{- with .Summary -}}
|
||||
{{- partial "function/content.html" . | safeHTML -}}
|
||||
{{- dict "content" . "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- .Description | safeHTML -}}
|
||||
{{- end -}}
|
||||
@@ -54,7 +53,7 @@
|
||||
{{- /* Footer */ -}}
|
||||
<div class="post-footer">
|
||||
<a href="{{ .RelPermalink }}">{{ T "readMore" }}</a>
|
||||
{{- with .Params.tags -}}
|
||||
{{- with $params.tags -}}
|
||||
<div class="post-tags">
|
||||
<i class="fas fa-tags fa-fw"></i>
|
||||
{{- range $index, $value := . -}}
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
{{- define "content" -}}
|
||||
<div class="page home">
|
||||
{{- /* Profile */ -}}
|
||||
{{- if .Site.Params.home.profile.enable -}}
|
||||
{{- if ne .Site.Params.home.profile.enable false -}}
|
||||
{{- partial "home/profile.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Posts */ -}}
|
||||
{{- if ne .Site.Params.home.posts.enable false -}}
|
||||
{{- /* Paginate */ -}}
|
||||
{{- $paginator := where .Site.RegularPages "Type" "posts" -}}
|
||||
{{- if ne .Site.Params.home.posts.mode.defaultHiddenFromHomePage false -}}
|
||||
{{- $paginator = where $paginator "Params.hiddenfromhomepage" "!=" true -}}
|
||||
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
|
||||
{{- if .Site.Params.page.hiddenFromHomePage -}}
|
||||
{{- $pages = where $pages "Params.hiddenfromhomepage" false -}}
|
||||
{{- else -}}
|
||||
{{- $paginator = where $paginator "Params.hiddenfromhomepage" false -}}
|
||||
{{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}}
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.home.posts.paginate -}}
|
||||
{{- $paginator = $.Paginate $paginator . -}}
|
||||
{{- else -}}
|
||||
{{- $paginator = $.Paginate $paginator -}}
|
||||
{{- end -}}
|
||||
{{- range $paginator.Pages -}}
|
||||
{{- $pages = .Site.Params.home.posts.paginate | default .Site.Params.paginate | .Paginate $pages -}}
|
||||
{{- range $pages.Pages -}}
|
||||
{{- .Render "summary" -}}
|
||||
{{- end -}}
|
||||
{{- partial "paginator.html" . -}}
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
{{- $index := slice -}}
|
||||
{{- range where .Site.RegularPages ".Params.hiddenfromsearch" "!=" true -}}
|
||||
{{- $pages := .Site.RegularPages -}}
|
||||
{{- if .Site.Params.page.hiddenFromSearch -}}
|
||||
{{- $pages = where $pages "Params.hiddenfromsearch" false -}}
|
||||
{{- else -}}
|
||||
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
|
||||
{{- end -}}
|
||||
{{- range $pages -}}
|
||||
{{- $params := .Params | merge $.Site.Params.page -}}
|
||||
{{- $one := dict "uri" .RelPermalink "title" .Title "description" (.Description | default "") -}}
|
||||
{{- $tags := .Params.tags | default slice -}}
|
||||
{{- $tags := $params.tags | default slice -}}
|
||||
{{- $one = delimit $tags "\n" | dict "tags" | merge $one -}}
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormat | default "2006-01-02") -}}
|
||||
{{- $one = dict "date" $publish_date | merge $one -}}
|
||||
{{- $content := partial "function/content.html" .Content | plainify -}}
|
||||
{{- $content := dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | plainify -}}
|
||||
{{- if gt .Site.Params.search.contentLength 0 -}}
|
||||
{{- $content = substr $content 0 .Site.Params.search.contentLength -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,66 +1,60 @@
|
||||
{{- $scratch := .Scratch.Get "scratch" -}}
|
||||
{{- $CDN := $scratch.Get "CDN" -}}
|
||||
{{- $fingerprint := $scratch.Get "fingerprint" -}}
|
||||
{{- $config := dict "desktopHeaderMode" .Site.Params.header.desktopMode "mobileHeaderMode" .Site.Params.header.mobileMode -}}
|
||||
{{- with $scratch.Get "contentData" -}}
|
||||
{{- $config = dict "content" . | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- with $scratch.Get "comment" -}}
|
||||
{{- $config = dict "comment" . | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $config := (.Scratch.Get "this").config -}}
|
||||
|
||||
{{- /* Fork Awesome */ -}}
|
||||
{{- if $scratch.Get "forkawesome" -}}
|
||||
{{- if (.Scratch.Get "this").forkawesome -}}
|
||||
{{- $options := dict "targetPath" "lib/forkawesome/fork-awesome.min.css" -}}
|
||||
{{- dict "source" "lib/forkawesome/fork-awesome.scss" "toCSS" $options "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- dict "source" "lib/forkawesome/fork-awesome.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* iconfont */ -}}
|
||||
{{- if $scratch.Get "iconfont" -}}
|
||||
{{- with $CDN.iconfontCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- if (.Scratch.Get "this").iconfont -}}
|
||||
{{- with $cdn.iconfontCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/iconfont/iconfont.css" "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- dict "source" "lib/iconfont/iconfont.css" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Smooth Scroll */ -}}
|
||||
{{- with $CDN.smoothScrollJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.smoothScrollJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/smooth-scroll/smooth-scroll.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/smooth-scroll/smooth-scroll.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Search */ -}}
|
||||
{{- if .Site.Params.search.enable -}}
|
||||
{{- with $CDN.autocompleteJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.autocompleteJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/autocomplete/autocomplete.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/autocomplete/autocomplete.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $searchConfig := dict "noResultsFound" (T "noResultsFound") -}}
|
||||
{{- if eq .Site.Params.search.type "lunr" -}}
|
||||
{{- with .Site.Home.OutputFormats.Get "json" -}}
|
||||
{{- $searchConfig = dict "type" "lunr" "lunrIndexURL" .RelPermalink | merge $searchConfig -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.lunrJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.lunrJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/lunr/lunr.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/lunr/lunr.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- if ne .Language.Lang "en" -}}
|
||||
{{- $searchConfig = T "lunrLanguageCode" | dict "lunrLanguageCode" | merge $searchConfig -}}
|
||||
{{- if eq .Language.Lang "zh-cn" -}}
|
||||
{{- $searchConfig = dict "lunrSegmentitURL" (resources.Get "lib/lunr/lunr.segmentit.js").RelPermalink | merge $searchConfig -}}
|
||||
{{- end -}}
|
||||
{{- dict "source" "lib/lunr/lunr.stemmer.support.js" "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" (T "lunrLanguageLib") "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/lunr/lunr.stemmer.support.js" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- dict "source" (T "lunrLanguageLib") "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- else if eq .Site.Params.search.type "algolia" -}}
|
||||
{{- with $CDN.algoliasearchJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.algoliasearchJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/algoliasearch/algoliasearch-lite.umd.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/algoliasearch/algoliasearch-lite.umd.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $searchConfig = dict "type" "algolia" "algoliaIndex" .Site.Params.search.algolia.index "algoliaAppID" .Site.Params.search.algolia.appID "algoliaSearchKey" .Site.Params.search.algolia.searchKey | merge $searchConfig -}}
|
||||
{{- end -}}
|
||||
@@ -68,61 +62,63 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- /* lazysizes */ -}}
|
||||
{{- with $CDN.lazysizesJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.lazysizesJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/lazysizes/lazysizes.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/lazysizes/lazysizes.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* lightgallery.js */ -}}
|
||||
{{- if ne .Site.Params.page.lightgallery false | and (ne .Params.lightgallery false) -}}
|
||||
{{- with $CDN.lightgalleryCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- if $params.lightgallery -}}
|
||||
{{- with $cdn.lightgalleryCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/lightgallery/lightgallery.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- dict "source" "lib/lightgallery/lightgallery.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.lightgalleryJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.lightgalleryJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/lightgallery/lightgallery.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/lightgallery/lightgallery.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.lightgalleryThumbnailJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.lightgalleryThumbnailJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/lightgallery/lg-thumbnail.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/lightgallery/lg-thumbnail.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.lightgalleryZoomJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.lightgalleryZoomJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/lightgallery/lg-zoom.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/lightgallery/lg-zoom.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $lightGalleryConfig := dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false -}}
|
||||
{{- $config = dict "lightGallery" $lightGalleryConfig | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* clipboard.js */ -}}
|
||||
{{- with $CDN.clipboardJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/clipboard/clipboard.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- if ne $params.copycode false -}}
|
||||
{{- with $cdn.clipboardJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/clipboard/clipboard.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $config = T "copyToClipboard" | dict "title" | dict "clipboard" | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- $config = T "copyToClipboard" | dict "title" | dict "clipboard" | merge $config -}}
|
||||
|
||||
{{- /* Sharer.js */ -}}
|
||||
{{- if $scratch.Get "share" -}}
|
||||
{{- with $CDN.sharerJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- if $params.share.enable -}}
|
||||
{{- with $cdn.sharerJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/sharer/sharer.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/sharer/sharer.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* TypeIt */ -}}
|
||||
{{- with $scratch.Get "typeitMap" -}}
|
||||
{{- with $CDN.typeitJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with (.Scratch.Get "this").typeitMap -}}
|
||||
{{- with $cdn.typeitJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/typeit/typeit.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/typeit/typeit.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $typeitConfig := slice -}}
|
||||
{{- range $key, $val := . -}}
|
||||
@@ -132,40 +128,40 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- /* KaTeX */ -}}
|
||||
{{- if ne .Site.Params.math.enable false | and .Params.math -}}
|
||||
{{- with $CDN.katexCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- if $params.math.enable -}}
|
||||
{{- with $cdn.katexCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/katex/katex.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- dict "source" "lib/katex/katex.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.katexJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.katexJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/katex/katex.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/katex/katex.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.katexAutoRenderJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.katexAutoRenderJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/katex/auto-render.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/katex/auto-render.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $math := .Site.Params.math -}}
|
||||
{{- $math := $params.math -}}
|
||||
{{- if $math.copyTex -}}
|
||||
{{- with $CDN.katexCopyTexCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- with $cdn.katexCopyTexCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/katex/copy-tex.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- dict "source" "lib/katex/copy-tex.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.katexCopyTexJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.katexCopyTexJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/katex/copy-tex.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/katex/copy-tex.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $math.mhchem -}}
|
||||
{{- with $CDN.katexMhchemJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.katexMhchemJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/katex/mhchem.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/katex/mhchem.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $mathConfig := dict "strict" false -}}
|
||||
@@ -182,91 +178,86 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- /* mermaid */ -}}
|
||||
{{- if $scratch.Get "mermaid" -}}
|
||||
{{- with $CDN.mermaidJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- if (.Scratch.Get "this").mermaid -}}
|
||||
{{- with $cdn.mermaidJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/mermaid/mermaid.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/mermaid/mermaid.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "targetPath" "lib/mermaid/mermaid.min.css" -}}
|
||||
{{- dict "source" "lib/mermaid/mermaid.scss" "toCSS" $options "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- dict "source" "lib/mermaid/mermaid.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* ECharts */ -}}
|
||||
{{- if $scratch.Get "echarts" -}}
|
||||
{{- with $CDN.echartsJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- if (.Scratch.Get "this").echarts -}}
|
||||
{{- with $cdn.echartsJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/echarts/echarts.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/echarts/echarts.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.echartsMacaronsJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.echartsMacaronsJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/echarts/macarons.js" "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/echarts/macarons.js" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Mapbox GL */ -}}
|
||||
{{- if $scratch.Get "mapbox" -}}
|
||||
{{- with $CDN.mapboxGLCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- if (.Scratch.Get "this").mapbox -}}
|
||||
{{- with $cdn.mapboxGLCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/mapbox-gl/mapbox-gl.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- dict "source" "lib/mapbox-gl/mapbox-gl.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.mapboxGLJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.mapboxGLJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/mapbox-gl/mapbox-gl.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/mapbox-gl/mapbox-gl.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- dict "source" "lib/mapbox-gl/mapbox-gl-language.js" "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- $mapbox := dict "accessToken" (.Params.mapbox.accessToken | default .Site.Params.mapbox.accessToken) "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" -}}
|
||||
{{- $config = dict "mapbox" $mapbox | merge $config -}}
|
||||
{{- dict "source" "lib/mapbox-gl/mapbox-gl-language.js" "minify" true "fingerprint" $fingerprint | 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 "music" -}}
|
||||
{{- if (.Scratch.Get "this").music -}}
|
||||
{{- /* APlayer */ -}}
|
||||
{{- with $CDN.aplayerCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- with $cdn.aplayerCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/aplayer/APlayer.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- dict "source" "lib/aplayer/APlayer.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" -}}
|
||||
{{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- with $CDN.aplayerJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- with $cdn.aplayerJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/aplayer/APlayer.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/aplayer/APlayer.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* MetingJS */ -}}
|
||||
{{- with $CDN.metingJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.metingJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/meting/Meting.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/meting/Meting.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Dev feature */ -}}
|
||||
{{- if .Params.dev -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Theme script */ -}}
|
||||
{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
|
||||
|
||||
{{- range $scratch.Get "stylesheet" -}}
|
||||
{{- range (.Scratch.Get "this").stylesheet -}}
|
||||
{{- partial "plugin/stylesheet.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
<script type="text/javascript">
|
||||
window.config = {{ jsonify $config | safeJS }};
|
||||
window.config = {{ $config | jsonify | safeJS }};
|
||||
</script>
|
||||
|
||||
{{- /* Polyfill.io */ -}}
|
||||
{{- partial "plugin/script.html" (dict "source" "https://polyfill.io/v3/polyfill.min.js?features=Element.prototype.closest%2CrequestAnimationFrame%2CCustomEvent%2CPromise%2CObject.entries%2CObject.assign%2CObject.values%2Cfetch%2CElement.prototype.after") -}}
|
||||
|
||||
{{- range $scratch.Get "script" -}}
|
||||
{{- range (.Scratch.Get "this").script -}}
|
||||
{{- partial "plugin/script.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -1,112 +1,106 @@
|
||||
{{- $scratch := .Scratch.Get "scratch" -}}
|
||||
{{- $CDN := $scratch.Get "CDN" -}}
|
||||
{{- $fingerprint := $scratch.Get "fingerprint" -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $comment := (.Scratch.Get "params").comment | default dict -}}
|
||||
{{- $commentConfig := dict -}}
|
||||
|
||||
{{- if eq hugo.Environment "production" | and (ne .Site.Params.comment.enable false) | and (ne .Params.comment false) -}}
|
||||
{{- if $comment.enable -}}
|
||||
<div id="comments">
|
||||
{{- /* Disqus Comment System */ -}}
|
||||
{{- if .Site.Params.comment.disqus.enable -}}
|
||||
{{- if $comment.disqus.enable -}}
|
||||
<div id="disqus_thread" class="comment"></div>
|
||||
{{- $source := printf "https://%s.disqus.com/embed.js" .Site.Params.comment.disqus.shortname -}}
|
||||
{{- dict "source" $source "defer" true "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- $source := printf "https://%s.disqus.com/embed.js" $comment.disqus.shortname -}}
|
||||
{{- dict "source" $source "defer" true "crossorigin" 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">Disqus</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Gitalk Comment System */ -}}
|
||||
{{- if .Site.Params.comment.gitalk.enable -}}
|
||||
{{- $gitalk := .Site.Params.comment.gitalk -}}
|
||||
{{- if $comment.gitalk.enable -}}
|
||||
<div id="gitalk" class="comment"></div>
|
||||
{{- with $CDN.gitalkCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- with $cdn.gitalkCSS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/gitalk/gitalk.css" "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- dict "source" "lib/gitalk/gitalk.css" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- end -}}
|
||||
{{- with $CDN.gitalkJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- with $cdn.gitalkJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/gitalk/gitalk.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/gitalk/gitalk.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $gitalkConfig := dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) -}}
|
||||
{{- $scratch.SetInMap "comment" "gitalk" $gitalkConfig -}}
|
||||
{{- $commentConfig = dict "id" .Date "title" .Title "clientID" $comment.gitalk.clientId "clientSecret" $comment.gitalk.clientSecret "repo" $comment.gitalk.repo "owner" $comment.gitalk.owner "admin" (slice $comment.gitalk.owner) | dict "gitalk" | merge $commentConfig -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk"></a>Gitalk</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Valine Comment System */ -}}
|
||||
{{- if .Site.Params.comment.valine.enable -}}
|
||||
{{- $valine := .Site.Params.comment.valine -}}
|
||||
{{- if $comment.valine.enable -}}
|
||||
<div id="valine" class="comment"></div>
|
||||
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
|
||||
{{- dict "source" "lib/valine/valine.scss" "toCSS" $options | slice | $scratch.Add "stylesheet" -}}
|
||||
{{- with $CDN.valineJS -}}
|
||||
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/valine/valine.scss" "toCSS" $options | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- with $cdn.valineJS -}}
|
||||
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- else -}}
|
||||
{{- dict "source" "lib/valine/Valine.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "lib/valine/Valine.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $valineConfig := dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default "en") "notify" $valine.notify "verify" $valine.verify "visitor" $valine.visitor "recordIP" $valine.recordIP -}}
|
||||
{{- with $valine.placeholder -}}
|
||||
{{- $valineConfig = dict "placeholder" . | merge $valineConfig -}}
|
||||
{{- $commentConfig = dict "el" "#valine" "appId" $comment.valine.appId "appKey" $comment.valine.appKey "lang" ($comment.valine.lang | default (T "valineLang")) "notify" $comment.valine.notify "verify" $comment.valine.verify "visitor" $comment.valine.visitor "recordIP" $comment.valine.recordIP "placeholder" ($comment.valine.placeholder | default (T "valinePlaceholder")) | dict "valine" | merge $commentConfig -}}
|
||||
{{- with $comment.valine.avatar -}}
|
||||
{{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}}
|
||||
{{- end -}}
|
||||
{{- with $valine.avatar -}}
|
||||
{{- $valineConfig = dict "avatar" . | merge $valineConfig -}}
|
||||
{{- with $comment.valine.meta -}}
|
||||
{{- $commentConfig = dict "meta" . | dict "valine" | merge $commentConfig -}}
|
||||
{{- end -}}
|
||||
{{- with $valine.meta -}}
|
||||
{{- $valineConfig = dict "meta" . | merge $valineConfig -}}
|
||||
{{- with $comment.valine.pageSize -}}
|
||||
{{- $commentConfig = dict "pageSize" . | dict "valine" | merge $commentConfig -}}
|
||||
{{- end -}}
|
||||
{{- with $valine.pageSize -}}
|
||||
{{- $valineConfig = dict "pageSize" . | merge $valineConfig -}}
|
||||
{{- end -}}
|
||||
{{- $scratch.SetInMap "comment" "valine" $valineConfig -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://valine.js.org/">Valine</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Facebook Comment System */ -}}
|
||||
{{- if .Site.Params.comment.facebook.enable -}}
|
||||
{{- $facebook := .Site.Params.comment.facebook -}}
|
||||
{{- if $comment.facebook.enable -}}
|
||||
<div id="fb-root" class="comment"></div>
|
||||
<div
|
||||
class="fb-comments"
|
||||
data-href="{{ .Site.Params.baseURL }}{{ .Permalink | absURL }}"
|
||||
data-width="{{ $facebook.width }}"
|
||||
data-numposts="{{ $facebook.numPosts }}"
|
||||
data-href="{{ .Permalink | absURL }}"
|
||||
data-width="{{ $comment.facebook.width }}"
|
||||
data-numposts="{{ $comment.facebook.numPosts }}"
|
||||
></div>
|
||||
{{- $source := printf "https://connect.facebook.net/%s/sdk.js#xfbml=1&version=v5.0&appId=%s&autoLogAppEvents=1" $facebook.languageCode $facebook.appId -}}
|
||||
{{- dict "source" $source "defer" true "crossorigin" true | slice | $scratch.Add "script" -}}
|
||||
{{- $source := printf "https://connect.facebook.net/%s/sdk.js#xfbml=1&version=v5.0&appId=%s&autoLogAppEvents=1" ($comment.facebook.languageCode | default (T "facebookLanguageCode")) $comment.facebook.appId -}}
|
||||
{{- dict "source" $source "defer" true "crossorigin" 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/"></a>Facebook</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Telegram Comments System */ -}}
|
||||
{{- if .Site.Params.comment.telegram.enable -}}
|
||||
{{- $telegram := .Site.Params.comment.telegram -}}
|
||||
{{- if $comment.telegram.enable -}}
|
||||
<div id="telegram-comments" class="comment"></div>
|
||||
{{- $attr := printf `data-comments-app-website="%s"` $telegram.siteID -}}
|
||||
{{- $attr = printf `%s data-limit="%s"` $attr ($telegram.limit | default 5) -}}
|
||||
{{- with $telegram.height -}}
|
||||
{{- $attr := printf `data-comments-app-website="%s"` $comment.telegram.siteID -}}
|
||||
{{- $attr = printf `%s data-limit="%s"` $attr ($comment.telegram.limit | default 5) -}}
|
||||
{{- with $comment.telegram.height -}}
|
||||
{{- $attr = printf `%s data-height="%s"` $attr . -}}
|
||||
{{- end -}}
|
||||
{{- with $telegram.color -}}
|
||||
{{- with $comment.telegram.color -}}
|
||||
{{- $attr = printf `%s data-color="%s"` $attr . -}}
|
||||
{{- end -}}
|
||||
{{- if $telegram.colorful -}}
|
||||
{{- if $comment.telegram.colorful -}}
|
||||
{{- $attr = printf `%s data-colorful="1"` $attr -}}
|
||||
{{- end -}}
|
||||
{{- if $telegram.dislikes -}}
|
||||
{{- if $comment.telegram.dislikes -}}
|
||||
{{- $attr = printf `%s data-dislikes="1"` $attr -}}
|
||||
{{- end -}}
|
||||
{{- if $telegram.outlined -}}
|
||||
{{- if $comment.telegram.outlined -}}
|
||||
{{- $attr = printf `%s data-outlined="1"` $attr -}}
|
||||
{{- end -}}
|
||||
{{- dict "source" "https://comments.app/js/widget.js?2" "defer" true "crossorigin" true "attr" $attr | slice | $scratch.Add "script" -}}
|
||||
{{- dict "source" "https://comments.app/js/widget.js?2" "defer" true "crossorigin" true "attr" $attr | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- dict "comment" $commentConfig | dict "config" | merge (.Scratch.Get "this") | .Scratch.Set "this" -}}
|
||||
|
||||
@@ -1,39 +1,50 @@
|
||||
{{- $scratch := .Scratch.Get "scratch" -}}
|
||||
{{- if ne .Site.Params.footer.enable false -}}
|
||||
<footer class="footer">
|
||||
<div class="footer-container">
|
||||
{{- /* Custom Content */ -}}
|
||||
{{- with .Site.Params.footer.custom -}}
|
||||
<div class="footer-line">
|
||||
{{- safeHTML . -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
<footer class="footer">
|
||||
<div class="copyright">
|
||||
{{- /* Hugo and LoveIt */ -}}
|
||||
<div class="copyright-line">
|
||||
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo %s">Hugo</a>` hugo.Version -}}
|
||||
{{- printf (T "poweredBySome") $hugo | safeHTML }} | {{ T "theme" }} - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt {{ $scratch.Get "version" }}"><i class="far fa-heart fa-fw"></i> LoveIt</a>
|
||||
{{- /* Hugo and LoveIt */ -}}
|
||||
{{- if ne .Site.Params.footer.hugo false -}}
|
||||
<div class="footer-line">
|
||||
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo %s">Hugo</a>` hugo.Version -}}
|
||||
{{- printf (T "poweredBySome") $hugo | safeHTML }} | {{ T "theme" }} - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt {{ .Scratch.Get `version` }}"><i class="far fa-heart fa-fw"></i> LoveIt</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
<div class="footer-line">
|
||||
{{- /* Copyright year */ -}}
|
||||
{{- if ne .Site.Params.footer.copyright false -}}
|
||||
<i class="far fa-copyright fa-fw"></i>
|
||||
{{- 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"> <a href="{{ $.Site.Author.link | default (relLangURL `/`) }}" target="_blank">{{ .Site.Author.name }}</a></span>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* License */ -}}
|
||||
{{- with .Site.Params.footer.license -}}
|
||||
| <span class="license">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* ICP */ -}}
|
||||
{{- with .Site.Params.footer.icp -}}
|
||||
<span class="icp-splitter"> | </span><br class="icp-br"/>
|
||||
<span class="icp">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="copyright-line">
|
||||
{{- /* Copyright year */ -}}
|
||||
<i class="far fa-copyright fa-fw"></i>
|
||||
{{- with .Site.Params.footer.since -}}
|
||||
<span itemprop="copyrightYear">
|
||||
{{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}}
|
||||
</span>
|
||||
{{- else -}}
|
||||
<span itemprop="copyrightYear">{{ now.Year }}</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Author */ -}}
|
||||
{{- with .Site.Author.name -}}
|
||||
<span class="author" itemprop="copyrightHolder"> <a href="{{ $.Site.Author.link | default (relLangURL `/`) }}" target="_blank">{{ . }}</a></span>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* License */ -}}
|
||||
{{- with .Site.Params.footer.license -}}
|
||||
| <span class="license">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* ICP */ -}}
|
||||
{{- with .Site.Params.footer.icp -}}
|
||||
<span class="icp-splitter"> | </span><br class="icp-br"/>
|
||||
<span class="icp">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</footer>
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
{{- $content := . -}}
|
||||
{{- $content := .content -}}
|
||||
|
||||
{{- $content = partial "function/ruby.html" $content -}}
|
||||
{{- if .ruby -}}
|
||||
{{- $content = partial "function/ruby.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $content = partial "function/fraction.html" $content -}}
|
||||
{{- if .fraction -}}
|
||||
{{- $content = partial "function/fraction.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $content = partial "function/fontawesome.html" $content -}}
|
||||
{{- if .fontawesome -}}
|
||||
{{- $content = partial "function/fontawesome.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $content = partial "function/checkbox.html" $content -}}
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
{{- /* shuffle md5 as id */ -}}
|
||||
{{- $id := delimit (split (md5 now.Unix) "" | shuffle | first 6) "" | printf "id-%s" -}}
|
||||
{{- with .scratch -}}
|
||||
{{- .SetInMap "contentData" $id $.content -}}
|
||||
{{- dict $id $.content | dict "data" | dict "config" | merge (.Get "this") | .Set "this" -}}
|
||||
{{- end -}}
|
||||
{{- return $id -}}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{{- $scratch := .Scratch.Get "scratch" -}}
|
||||
{{- $CDN := $scratch.Get "CDN" -}}
|
||||
{{- $fingerprint := $scratch.Get "fingerprint" -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
@@ -23,7 +22,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- /* normalize.css */ -}}
|
||||
{{- $source := $CDN.normalizeCSS | default "lib/normalize/normalize.min.css" -}}
|
||||
{{- $source := $cdn.normalizeCSS | default "lib/normalize/normalize.min.css" -}}
|
||||
{{- $stylesheet := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/stylesheet.html" $stylesheet -}}
|
||||
|
||||
@@ -34,11 +33,11 @@
|
||||
{{- partial "plugin/stylesheet.html" $stylesheet -}}
|
||||
|
||||
{{- /* Font Awesome */ -}}
|
||||
{{- $source := $CDN.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}}
|
||||
{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}}
|
||||
{{- $stylesheet := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/stylesheet.html" $stylesheet -}}
|
||||
|
||||
{{- /* Animate.css */ -}}
|
||||
{{- $source := $CDN.animateCSS | default "lib/animate/animate.min.css" -}}
|
||||
{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}}
|
||||
{{- $stylesheet := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/stylesheet.html" $stylesheet -}}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
{{- with .Site.Params.verification.google -}}
|
||||
<meta name="google-site-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
@@ -33,10 +35,10 @@
|
||||
{{- with .Site.Params.description -}}
|
||||
"description": "{{ . | safeJS }}",
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.image -}}
|
||||
{{- with $params.seo.image -}}
|
||||
"image": "{{ .url | absURL }}",
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.logo -}}
|
||||
{{- with $params.seo.logo -}}
|
||||
"thumbnailUrl": "{{ .url | absURL }}",
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
@@ -58,12 +60,12 @@
|
||||
"@type": "WebPage",
|
||||
"@id": "{{ .Permalink }}"
|
||||
},
|
||||
{{- if ge .Site.Params.image.width 696 -}}
|
||||
{{- if ge $params.seo.image.width 696 -}}
|
||||
"image": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ .Site.Params.image.url | absURL }}",
|
||||
"width": {{ .Site.Params.image.width }},
|
||||
"height": {{ .Site.Params.image.height }}
|
||||
"url": "{{ $params.seo.image.url | absURL }}",
|
||||
"width": {{ $params.seo.image.width }},
|
||||
"height": {{ $params.seo.image.height }}
|
||||
},
|
||||
{{- end -}}
|
||||
"genre": "{{ .Type }}",
|
||||
@@ -83,7 +85,7 @@
|
||||
{{- with .Site.Copyright -}}
|
||||
"license": "{{ . | safeJS }}",
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.publisher -}}
|
||||
{{- with $params.seo.publisher -}}
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
"name": "{{ .name | safeJS }}",
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{{- end -}}
|
||||
{{- if .Site.Params.search.enable -}}
|
||||
<span class="menu-item search" id="search-desktop">
|
||||
<input type="text" placeholder="{{ T `searchPlaceholder` }}" id="search-input-desktop">
|
||||
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `searchPlaceholder`) }}" id="search-input-desktop">
|
||||
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-desktop" title="{{ T `search` }}">
|
||||
<i class="fas fa-search fa-fw"></i>
|
||||
</a>
|
||||
@@ -73,7 +73,7 @@
|
||||
{{- if .Site.Params.search.enable -}}
|
||||
<div class="search-wrapper">
|
||||
<div class="search mobile" id="search-mobile">
|
||||
<input type="text" placeholder="{{ T `searchPlaceholder` }}" id="search-input-mobile">
|
||||
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `searchPlaceholder`) }}" id="search-input-mobile">
|
||||
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-mobile" title="{{ T `search` }}">
|
||||
<i class="fas fa-search fa-fw"></i>
|
||||
</a>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{{- $scratch := .Scratch.Get "scratch" -}}
|
||||
|
||||
<div class="home-profile">
|
||||
{{- $avatar := .Site.Params.home.profile.avatarURL -}}
|
||||
{{- with .Site.Params.home.profile.gravatarEmail -}}
|
||||
@@ -16,9 +14,9 @@
|
||||
{{- with .Site.Params.home.profile.subtitle -}}
|
||||
<h2 class="home-subtitle">
|
||||
{{- if $.Site.Params.home.profile.typeit -}}
|
||||
{{- $id := partial "function/id.html" (dict "content" . "scratch" $scratch) -}}
|
||||
{{- $id := partial "function/id.html" (dict "content" . "scratch" $.Scratch) -}}
|
||||
<div id="{{ $id }}" class="typeit"></div>
|
||||
{{- $scratch.SetInMap "typeitMap" $id (slice $id) -}}
|
||||
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
|
||||
{{- else -}}
|
||||
{{- . -}}
|
||||
{{- end -}}
|
||||
@@ -26,7 +24,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Site.Params.home.profile.social -}}
|
||||
{{- partial "plugin/social.html" (dict "social" .Site.Params.social "scratch" $scratch) -}}
|
||||
{{- partial "plugin/social.html" (dict "social" .Site.Params.social "scratch" $.Scratch) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Site.Params.home.profile.disclaimer -}}
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
{{- end -}}
|
||||
{{- $classList = $newClassList -}}
|
||||
{{- with .scratch -}}
|
||||
{{- .Set "forkawesome" true -}}
|
||||
{{- dict "forkawesome" true | merge (.Get "this") | .Set "this" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* default is Font Awesome */ -}}
|
||||
{{- /* Others */ -}}
|
||||
{{- else if ne $type "fa" -}}
|
||||
{{- with .scratch -}}
|
||||
{{- .Set "iconfont" true -}}
|
||||
{{- dict "iconfont" true | merge (.Get "this") | .Set "this" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<i class="{{ delimit $classList ` ` }}"></i>
|
||||
@@ -1,199 +1,197 @@
|
||||
{{- $scratch := .Scratch.Get "scratch" -}}
|
||||
|
||||
{{- if ne .Site.Params.share.enable false | and (ne .Params.share.enable false) -}}
|
||||
{{- $scratch.Set "share" true -}}
|
||||
{{- $share := (.Scratch.Get "params").page.share | default dict -}}
|
||||
|
||||
{{- if $share.enable -}}
|
||||
{{- /* 001: Twitter */ -}}
|
||||
{{- if .Params.Share.Twitter | default .Site.Params.Share.Twitter | eq true -}}
|
||||
{{- 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 }}>
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-twitter fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 002: Facebook */ -}}
|
||||
{{- if .Params.Share.Facebook | default .Site.Params.Share.Facebook | eq true -}}
|
||||
{{- 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 }}>
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-facebook-square fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 003: Linkedin */ -}}
|
||||
{{- if .Params.Share.Linkedin | default .Site.Params.Share.Linkedin | eq true -}}
|
||||
{{- if $share.Linkedin -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Linkedin" data-sharer="linkedin" data-url="{{ .Permalink }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-linkedin fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 004: WhatsApp */ -}}
|
||||
{{- if .Params.Share.Whatsapp | default .Site.Params.Share.Whatsapp | eq true -}}
|
||||
{{- if $share.Whatsapp -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} WhatsApp" data-sharer="whatsapp" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-web>
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-whatsapp fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 005: Viber */ -}}
|
||||
{{- if .Params.Share.Viber | default .Site.Params.Share.Viber | eq true -}}
|
||||
{{- if $share.Viber -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Viber" data-sharer="viber" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-viber fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 006: Pinterest */ -}}
|
||||
{{- if .Params.Share.Pinterest | default .Site.Params.Share.Pinterest | eq true -}}
|
||||
{{- 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 }}>
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-pinterest fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 007: Tumblr */ -}}
|
||||
{{- if .Params.Share.Tumblr | default .Site.Params.Share.Tumblr | eq true -}}
|
||||
{{- 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 }}>
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-tumblr fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 008: Hacker News */ -}}
|
||||
{{- if .Params.Share.Hackernews | default .Site.Params.Share.Hackernews | eq true -}}
|
||||
{{- if $share.Hackernews -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Hacker News" data-sharer="hackernews" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-hacker-news fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 009: Reddit */ -}}
|
||||
{{- if .Params.Share.Reddit | default .Site.Params.Share.Reddit | eq true -}}
|
||||
{{- if $share.Reddit -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Reddit" data-sharer="reddit" data-url="{{ .Permalink }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-reddit fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 010: VK */ -}}
|
||||
{{- if .Params.Share.VK | default .Site.Params.Share.VK | eq true -}}
|
||||
{{- 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 }}>
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-vk fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 011: Buffer */ -}}
|
||||
{{- if .Params.Share.Buffer | default .Site.Params.Share.Buffer | eq true -}}
|
||||
{{- 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 }}>
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-buffer fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 012: Xing */ -}}
|
||||
{{- if .Params.Share.Xing | default .Site.Params.Share.Xing | eq true -}}
|
||||
{{- if $share.Xing -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Xing" data-sharer="xing" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-xing fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 013: Line */ -}}
|
||||
{{- if .Params.Share.Line | default .Site.Params.Share.Line | eq true -}}
|
||||
{{- if $share.Line -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Line" data-sharer="line" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-line fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 014: Instapaper */ -}}
|
||||
{{- if .Params.Share.Instapaper | default .Site.Params.Share.Instapaper | eq true -}}
|
||||
{{- if $share.Instapaper -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Instapaper" data-sharer="instapaper" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "loveit it-instapaper-fill" "type" "other" "scratch" $scratch) -}}
|
||||
{{- partial "plugin/icon.html" (dict "class" "loveit it-instapaper-fill" "type" "other" "scratch" .Scratch) -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 015: Pocket */ -}}
|
||||
{{- if .Params.Share.Pocket | default .Site.Params.Share.Pocket | eq true -}}
|
||||
{{- if $share.Pocket -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pocket" data-sharer="pocket" data-url="{{ .Permalink }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-get-pocket fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 016: Digg */ -}}
|
||||
{{- if .Params.Share.Digg | default .Site.Params.Share.Digg | eq true -}}
|
||||
{{- if $share.Digg -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Digg" data-sharer="digg" data-url="{{ .Permalink }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-digg fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 017: StumbleUpon */ -}}
|
||||
{{- if .Params.Share.Stumbleupon | default .Site.Params.Share.Stumbleupon | eq true -}}
|
||||
{{- if $share.Stumbleupon -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} StumbleUpon" data-sharer="stumbleupon" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-stumbleupon fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 018: Flipboard */ -}}
|
||||
{{- if .Params.Share.Flipboard | default .Site.Params.Share.Flipboard | eq true -}}
|
||||
{{- if $share.Flipboard -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Flipboard" data-sharer="flipboard" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-flipboard fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 019: 微博 */ -}}
|
||||
{{- if .Params.Share.Weibo | default .Site.Params.Share.Weibo | eq true -}}
|
||||
{{- 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 }}>
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-weibo fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 020: 人人 */ -}}
|
||||
{{- if .Params.Share.Renren | default .Site.Params.Share.Renren | eq true -}}
|
||||
{{- if $share.Renren -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} 人人" data-sharer="renren" data-url="{{ .Permalink }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-renren fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 021: Myspace */ -}}
|
||||
{{- if .Params.Share.Myspace | default .Site.Params.Share.Myspace | eq true -}}
|
||||
{{- if $share.Myspace -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Myspace" data-sharer="myspace" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "loveit it-myspace-fill" "type" "other" "scratch" $scratch) -}}
|
||||
{{- partial "plugin/icon.html" (dict "class" "loveit it-myspace-fill" "type" "other" "scratch" .Scratch) -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 022: Blogger */ -}}
|
||||
{{- if .Params.Share.Blogger | default .Site.Params.Share.Blogger | eq true -}}
|
||||
{{- if $share.Blogger -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Blogger" data-sharer="blogger" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-blogger fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 023: 百度 */ -}}
|
||||
{{- if .Params.Share.Baidu | default .Site.Params.Share.Baidu | eq true -}}
|
||||
{{- if $share.Baidu -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "loveit it-baidu-fill" "type" "other" "scratch" $scratch) -}}
|
||||
{{- partial "plugin/icon.html" (dict "class" "loveit it-baidu-fill" "type" "other" "scratch" .Scratch) -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 024: OK.RU */ -}}
|
||||
{{- if .Params.Share.Odnoklassniki | default .Site.Params.Share.Odnoklassniki | eq true -}}
|
||||
{{- if $share.Odnoklassniki -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} OK.RU" data-sharer="okru" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-odnoklassniki fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 025: Evernote */ -}}
|
||||
{{- if .Params.Share.Evernote | default .Site.Params.Share.Evernote | eq true -}}
|
||||
{{- if $share.Evernote -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Evernote" data-sharer="evernote" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-evernote fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 026: Skype */ -}}
|
||||
{{- if .Params.Share.Skype | default .Site.Params.Share.Skype | eq true -}}
|
||||
{{- if $share.Skype -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Skype" data-sharer="skype" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-skype fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 027: Trello */ -}}
|
||||
{{- if .Params.Share.Trello | default .Site.Params.Share.Trello | eq true -}}
|
||||
{{- if $share.Trello -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Trello" data-sharer="trello" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-trello fa-fw") -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 028: Mix */ -}}
|
||||
{{- if .Params.Share.Mix | default .Site.Params.Share.Mix | eq true -}}
|
||||
{{- if $share.Mix -}}
|
||||
<a href="//mix.com/add?url={{ .Permalink }}&description={{ .Title }}" target="_blank" title="{{ T `shareOn` }} Mix">
|
||||
{{- partial "plugin/icon.html" (dict "class" "fab fa-mix fa-fw") -}}
|
||||
</a>
|
||||
|
||||
4
layouts/partials/scratch/script.html
Normal file
4
layouts/partials/scratch/script.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{{- $this := .scratch.Get "this" -}}
|
||||
{{- $script := $this.script | default slice -}}
|
||||
{{- $script = $script | append (slice .data) -}}
|
||||
{{- .scratch.SetInMap "this" "script" $script -}}
|
||||
4
layouts/partials/scratch/stylesheet.html
Normal file
4
layouts/partials/scratch/stylesheet.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{{- $this := .scratch.Get "this" -}}
|
||||
{{- $stylesheet := $this.stylesheet | default slice -}}
|
||||
{{- $stylesheet = $stylesheet | append (slice .data) -}}
|
||||
{{- .scratch.SetInMap "this" "stylesheet" $stylesheet -}}
|
||||
@@ -1,4 +1,5 @@
|
||||
{{- $modify_date := .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $modify_date := .Lastmod.Format (.Site.Params.dateformat | default "2006-01-02") -}}
|
||||
<div class="post-footer" id="post-footer">
|
||||
<div class="post-info">
|
||||
<div class="post-info-line">
|
||||
@@ -14,16 +15,16 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="post-info-license">
|
||||
{{- if .Params.license -}}
|
||||
{{- with $params.license -}}
|
||||
<span>
|
||||
{{- printf (T "license") .Params.license | safeHTML -}}
|
||||
{{- printf (T "license") . | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-info-line">
|
||||
<div class="post-info-md">
|
||||
{{- if ne .Site.Params.page.linkToMarkdown false | and (ne .Params.linkToMarkdown false) -}}
|
||||
{{- if $params.linktomarkdown -}}
|
||||
{{- with .OutputFormats.Get "markdown" -}}
|
||||
<span>
|
||||
<a class="link-to-markdown" href="{{ .RelPermalink }}" target="_blank">
|
||||
@@ -43,7 +44,7 @@
|
||||
|
||||
<div class="post-info-more">
|
||||
<section class="post-tags">
|
||||
{{- with .Params.tags -}}
|
||||
{{- with $params.tags -}}
|
||||
<i class="fas fa-tags fa-fw"></i>
|
||||
{{- range $index, $value := . -}}
|
||||
{{- if gt $index 0 }}, {{ end -}}
|
||||
|
||||
@@ -1,35 +1,36 @@
|
||||
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $scratch := .Scratch.Get "scratch" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
{{- /* Auto TOC */ -}}
|
||||
{{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
|
||||
{{- if ne $params.toc.enable false -}}
|
||||
<div class="toc" id="toc-auto">
|
||||
<h2 class="toc-title">{{ T "contents" }}</h2>
|
||||
{{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }}
|
||||
<div class="toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false)) }} always-active{{ end }}" id="toc-content-auto"></div>
|
||||
<div class="toc-content{{ if eq $params.toc.auto false }} always-active{{ end }}" id="toc-content-auto"></div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
<article class="page single">
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title animated flipInX">{{ .Title }}</h1>
|
||||
{{- with .Params.subtitle -}}
|
||||
|
||||
{{- /* Subtitle */ -}}
|
||||
{{- with $params.subtitle -}}
|
||||
<h2 class="single-subtitle">{{ . }}</h2>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Meta */ -}}
|
||||
<div class="post-meta">
|
||||
<div class="post-meta-line">
|
||||
{{- $author := .Params.author | default .Site.Author.name | default (T "author") -}}
|
||||
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
|
||||
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
|
||||
{{- $authorLink := $params.authorlink | default .Site.Author.link | default (relLangURL "/") -}}
|
||||
<span class="post-author">
|
||||
{{- $options := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
</span>
|
||||
|
||||
{{- with .Params.categories -}}
|
||||
{{- with $params.categories -}}
|
||||
|
||||
<span class="post-category">
|
||||
{{- T "included" -}}
|
||||
@@ -43,11 +44,12 @@
|
||||
{{- end -}}
|
||||
</div>
|
||||
<div class="post-meta-line">
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateformat | default "2006-01-02") -}}
|
||||
<i class="far fa-calendar-alt fa-fw"></i><time datetime={{ $publish_date }}>{{ $publish_date }}</time>
|
||||
<i class="fas fa-pencil-alt fa-fw"></i>{{ T "wordCount" .WordCount }}
|
||||
<i class="far fa-clock fa-fw"></i>{{ T "readingTime" .ReadingTime }}
|
||||
{{- if eq hugo.Environment "production" | and .Site.Params.comment.valine.enable | and .Site.Params.comment.valine.visitor -}}
|
||||
{{- $comment := $params.comment | default dict -}}
|
||||
{{- if $comment.enable | and $comment.valine.enable | and $comment.valine.visitor -}}
|
||||
<span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
|
||||
<i class="far fa-eye fa-fw"></i><span class=leancloud-visitors-count></span> {{ T "views" }}
|
||||
</span>
|
||||
@@ -56,14 +58,14 @@
|
||||
</div>
|
||||
|
||||
{{- /* Featured image */ -}}
|
||||
{{- with .Params.featuredImage -}}
|
||||
{{- with $params.featuredimage -}}
|
||||
<div class="featured-image">
|
||||
{{- partial "plugin/image.html" (dict "src" . "alt" $.Description "large" true) -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Static TOC */ -}}
|
||||
{{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
|
||||
{{- if $params.toc.enable -}}
|
||||
<div class="toc" id="toc-static">
|
||||
<details>
|
||||
<summary>
|
||||
@@ -84,15 +86,13 @@
|
||||
|
||||
{{- /* Content */ -}}
|
||||
<div class="content" id="content">
|
||||
{{- partial "function/content.html" .Content | safeHTML -}}
|
||||
{{- dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
</div>
|
||||
|
||||
{{- /* Footer */ -}}
|
||||
{{- partial "single/footer.html" . -}}
|
||||
|
||||
{{- /* Comment */ -}}
|
||||
{{- if ( .Params.comment | default true ) -}}
|
||||
{{- partial "comment.html" . -}}
|
||||
{{- end -}}
|
||||
{{- partial "comment.html" . -}}
|
||||
</article>
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
{{- $scratch := .Page.Scratch.Get "scratch" -}}
|
||||
|
||||
{{- $content := .Inner | transform.Unmarshal | jsonify -}}
|
||||
{{- $id := partial "function/id.html" (dict "content" $content "scratch" $scratch) -}}
|
||||
{{- $id := partial "function/id.html" (dict "content" $content "scratch" .Page.Scratch) -}}
|
||||
{{- $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>
|
||||
{{- $scratch.Set "echarts" true -}}
|
||||
{{- dict "echarts" true | merge (.Page.Scratch.Get "this") | .Page.Scratch.Set "this" -}}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{{- $scratch := .Page.Scratch.Get "scratch" -}}
|
||||
{{- $mapbox := (.Page.Scratch.Get "params").page.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 := .Page.Params.mapbox.lightStyle | default .Page.Site.Params.mapbox.lightStyle -}}
|
||||
{{- $darkStyle := .Page.Params.mapbox.darkStyle | default .Page.Site.Params.mapbox.darkStyle -}}
|
||||
{{- $navigation := ne .Page.Params.mapbox.navigation false | and (ne .Page.Site.Params.mapbox.navigation false) -}}
|
||||
{{- $geolocate := ne .Page.Params.mapbox.geolocate false | and (ne .Page.Site.Params.mapbox.geolocate false) -}}
|
||||
{{- $scale := ne .Page.Params.mapbox.scale false | and (ne .Page.Site.Params.mapbox.scale false) -}}
|
||||
{{- $fullscreen := ne .Page.Params.mapbox.fullscreen false | and (ne .Page.Site.Params.mapbox.fullscreen false) -}}
|
||||
{{- $lightStyle := $mapbox.lightStyle -}}
|
||||
{{- $darkStyle := $mapbox.darkStyle -}}
|
||||
{{- $navigation := $mapbox.navigation -}}
|
||||
{{- $geolocate := $mapbox.geolocate -}}
|
||||
{{- $scale := $mapbox.scale -}}
|
||||
{{- $fullscreen := $mapbox.fullscreen -}}
|
||||
{{- $width := "100%" -}}
|
||||
{{- $height := "20rem" -}}
|
||||
|
||||
@@ -28,6 +28,6 @@
|
||||
{{- 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 := partial "function/id.html" (dict "content" $options "scratch" $scratch) -}}
|
||||
{{- $id := partial "function/id.html" (dict "content" $options "scratch" .Page.Scratch) -}}
|
||||
<div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
|
||||
{{- $scratch.Set "mapbox" true -}}
|
||||
{{- dict "mapbox" true | merge (.Page.Scratch.Get "this") | .Page.Scratch.Set "this" -}}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{{- $scratch := .Page.Scratch.Get "scratch" -}}
|
||||
|
||||
{{- $id := partial "function/id.html" (dict "content" (trim .Inner "\n") "scratch" $scratch) -}}
|
||||
{{- $id := partial "function/id.html" (dict "content" (trim .Inner "\n") "scratch" .Page.Scratch) -}}
|
||||
<div class="mermaid" id="{{ $id }}"></div>
|
||||
{{- $scratch.Set "mermaid" true -}}
|
||||
{{- dict "mermaid" true | merge (.Page.Scratch.Get "this") | .Page.Scratch.Set "this" -}}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{{- $scratch := .Page.Scratch.Get "scratch" -}}
|
||||
|
||||
{{- $theme := "#448aff" -}}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $theme = .Get "theme" | default $theme -}}
|
||||
@@ -41,4 +39,4 @@
|
||||
{{- else -}}
|
||||
<meting-js server="{{ .Get 0 }}" type="{{ .Get 1 }}" id="{{ .Get 2 }}" theme="{{ $theme }}"></meting-js>
|
||||
{{- end -}}
|
||||
{{- $scratch.Set "music" true -}}
|
||||
{{- dict "music" true | merge (.Page.Scratch.Get "this") | .Page.Scratch.Set "this" -}}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{{- $scratch := .Page.Scratch.Get "scratch" -}}
|
||||
|
||||
{{- $content := .Inner -}}
|
||||
{{- $classList := .Get "class" | slice -}}
|
||||
{{- $tag := .Get "tag" | default "div" -}}
|
||||
@@ -22,11 +20,11 @@
|
||||
|
||||
{{- /* trim the newline */ -}}
|
||||
{{- $content = trim $content "\n" -}}
|
||||
{{- $id := partial "function/id.html" (dict "content" $content "scratch" $scratch) -}}
|
||||
{{- $key := .Get "group" | default $id -}}
|
||||
{{- $group := index ($scratch.Get "typeitMap" | default dict) $key -}}
|
||||
{{- $id := partial "function/id.html" (dict "content" $content "scratch" .Page.Scratch) -}}
|
||||
{{- $key := .Get "group" | string | default $id -}}
|
||||
{{- $group := index ((.Page.Scratch.Get "this").typeitMap | default dict) $key -}}
|
||||
{{- $group = $group | default slice | append $id -}}
|
||||
{{- $scratch.SetInMap "typeitMap" $key $group -}}
|
||||
{{- dict $key $group | dict "typeitMap" | merge (.Page.Scratch.Get "this") | .Page.Scratch.Set "this" -}}
|
||||
|
||||
<div class="typeit">
|
||||
{{- printf `<%s id="%s" class="%s"></%s>` $tag $id (delimit $classList " ") $tag | safeHTML -}}
|
||||
|
||||
@@ -12,12 +12,13 @@
|
||||
{{- else if eq $taxonomy "tag" -}}
|
||||
<i class="fas fa-tag fa-fw"></i> {{ humanize .Title }}
|
||||
{{- else -}}
|
||||
{{- printf "%s - %s" (T $taxonomy | default (humanize $taxonomy)) .Title -}}
|
||||
{{- printf "%s - %s" (T $taxonomy | default (humanize $taxonomy)) .Title -}}
|
||||
{{- end -}}
|
||||
</h2>
|
||||
|
||||
{{- /* Paginate */ -}}
|
||||
{{- range (.Paginate (.Pages.GroupByDate "2006")).PageGroups -}}
|
||||
{{- $pages := .Pages.GroupByDate "2006" -}}
|
||||
{{- range (.Site.Params.list.paginate | default .Site.Params.paginate | .Paginate $pages).PageGroups -}}
|
||||
<h3>{{ .Key }}</h3>
|
||||
{{- range .Pages -}}
|
||||
<article class="archive-item">
|
||||
@@ -25,7 +26,7 @@
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
<span class="archive-item-date">
|
||||
{{- .Date.Format (.Site.Params.dateFormatToUse | default "01-02") -}}
|
||||
{{- .Date.Format ($.Site.Params.list.dateFormat | default "01-02") -}}
|
||||
</span>
|
||||
</article>
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user