feat: improve configuration (#245)

* feat: improve configuration

* fix: fix partials/footer.html error
This commit is contained in:
Dillon
2020-04-21 22:55:06 +08:00
committed by GitHub
parent 8a0e61085c
commit f14301c395
62 changed files with 1548 additions and 1669 deletions

View File

@@ -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 -}}

View File

@@ -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" -}}

View File

@@ -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">&nbsp;<a href="{{ $.Site.Author.link | default (relLangURL `/`) }}" target="_blank">{{ .Site.Author.name }}</a></span>
{{- end -}}
{{- /* License */ -}}
{{- with .Site.Params.footer.license -}}
&nbsp;|&nbsp;<span class="license">{{ . | safeHTML }}</span>
{{- end -}}
{{- /* ICP */ -}}
{{- with .Site.Params.footer.icp -}}
<span class="icp-splitter">&nbsp;|&nbsp;</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">&nbsp;<a href="{{ $.Site.Author.link | default (relLangURL `/`) }}" target="_blank">{{ . }}</a></span>
{{- end -}}
{{- /* License */ -}}
{{- with .Site.Params.footer.license -}}
&nbsp;|&nbsp;<span class="license">{{ . | safeHTML }}</span>
{{- end -}}
{{- /* ICP */ -}}
{{- with .Site.Params.footer.icp -}}
<span class="icp-splitter">&nbsp;|&nbsp;</span><br class="icp-br"/>
<span class="icp">{{ . | safeHTML }}</span>
{{- end -}}
</div>
</div>
</footer>
</footer>
{{- end -}}

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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 }}",

View File

@@ -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>

View File

@@ -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 -}}

View File

@@ -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>

View File

@@ -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 }}&amp;description={{ .Title }}" target="_blank" title="{{ T `shareOn` }} Mix">
{{- partial "plugin/icon.html" (dict "class" "fab fa-mix fa-fw") -}}
</a>

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" -}}
{{- $stylesheet := $this.stylesheet | default slice -}}
{{- $stylesheet = $stylesheet | append (slice .data) -}}
{{- .scratch.SetInMap "this" "stylesheet" $stylesheet -}}

View File

@@ -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>&nbsp;
{{- range $index, $value := . -}}
{{- if gt $index 0 }},&nbsp;{{ end -}}