feat(content): support complete local resource references (#388)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{{- with .Title -}}
|
||||
{{- if .Title -}}
|
||||
<figure>
|
||||
{{- dict "src" $.Destination "alt" $.Text "caption" . "linked" true | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- . | safeHTML -}}
|
||||
{{- .Title | safeHTML -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
{{- dict "src" .Destination "alt" .Text | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
{{- $options := dict "href" .Destination "title" .Title "content" .Text -}}
|
||||
{{- $destination := .Destination -}}
|
||||
{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "Destination" $destination "Title" .Title "Content" .Text -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
{{- $params := .Params | merge .Site.Params.page -}}
|
||||
|
||||
<article class="single summary" itemscope itemtype="http://schema.org/Article">
|
||||
{{- /* Featured image */ -}}
|
||||
{{- with $params.featuredimagepreview | default $params.featuredimage -}}
|
||||
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}}
|
||||
{{- with .Resources.GetMatch "featured-image" -}}
|
||||
{{- $image = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- with .Resources.GetMatch "featured-image-preview" -}}
|
||||
{{- $image = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- with $image -}}
|
||||
<div class="featured-image-preview">
|
||||
<a href="{{ $.RelPermalink }}">
|
||||
{{- dict "src" . "alt" $.Description "large" true | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
@@ -19,7 +27,7 @@
|
||||
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
|
||||
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
|
||||
<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 -}}
|
||||
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
</span>
|
||||
|
||||
|
||||
@@ -5,59 +5,57 @@
|
||||
|
||||
{{- /* Smooth Scroll */ -}}
|
||||
{{- $source := $cdn.smoothScrollJS | default "lib/smooth-scroll/smooth-scroll.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* Search */ -}}
|
||||
{{- if .Site.Params.search | and .Site.Params.search.enable -}}
|
||||
{{- $search := .Site.Params.search -}}
|
||||
{{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "noResultsFound") | dict "search" | merge $config -}}
|
||||
{{- if eq $search.type "lunr" -}}
|
||||
{{- with .Site.Home.OutputFormats.Get "json" -}}
|
||||
{{- $config = dict "type" "lunr" "lunrIndexURL" .RelPermalink | dict "search" | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- $source := $cdn.lunrJS | default "lib/lunr/lunr.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- if T "lunrLanguageLib" -}}
|
||||
{{- $config = T "lunrLanguageCode" | dict "lunrLanguageCode" | dict "search" | merge $config -}}
|
||||
{{- with T "lunrSegmentitLib" -}}
|
||||
{{- $config = dict "lunrSegmentitURL" (resources.Get .).RelPermalink | dict "search" | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- 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" -}}
|
||||
{{- 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 $search.type "algolia" -}}
|
||||
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* lazysizes */ -}}
|
||||
{{- $source := $cdn.lazysizesJS | default "lib/lazysizes/lazysizes.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* twemoji */ -}}
|
||||
{{- if $params.twemoji -}}
|
||||
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "twemoji" true | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* lightgallery.js */ -}}
|
||||
{{- if $params.lightgallery -}}
|
||||
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/lightgallery.min.css" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/lg-thumbnail.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/lg-zoom.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false | dict "lightGallery" | merge $config -}}
|
||||
{{- $styleArr := (.Scratch.Get "this").styleArr | default slice -}}
|
||||
{{- $styleArr | append ".lg-toolbar .lg-icon::after { color: #999; }" | .Scratch.SetInMap "this" "styleArr" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $code := $params.code | default dict -}}
|
||||
@@ -66,21 +64,21 @@
|
||||
{{- /* clipboard.js */ -}}
|
||||
{{- if ne $code.copy false -}}
|
||||
{{- $source := $cdn.clipboardJS | default "lib/clipboard/clipboard.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = T "copyToClipboard" | dict "copyTitle" | dict "code" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Sharer.js */ -}}
|
||||
{{- if $params.share.enable -}}
|
||||
{{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* TypeIt */ -}}
|
||||
{{- with (.Scratch.Get "this").typeitMap -}}
|
||||
{{- $typeit := $.Site.Params.typeit -}}
|
||||
{{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -93,20 +91,20 @@
|
||||
{{- end -}}
|
||||
{{- if $math.enable -}}
|
||||
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- if $math.copyTex -}}
|
||||
{{- $source := $cdn.katexCopyTexCSS | default "lib/katex/copy-tex.min.css" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- if $math.mhchem -}}
|
||||
{{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}}
|
||||
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
|
||||
@@ -122,26 +120,26 @@
|
||||
{{- /* mermaid */ -}}
|
||||
{{- if (.Scratch.Get "this").mermaid -}}
|
||||
{{- $source := $cdn.mermaidJS | default "lib/mermaid/mermaid.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $options := dict "targetPath" "lib/mermaid/mermaid.min.css" "enableSourceMap" true -}}
|
||||
{{- dict "source" "lib/mermaid/mermaid.scss" "toCSS" $options "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" "lib/mermaid/mermaid.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* ECharts */ -}}
|
||||
{{- if (.Scratch.Get "this").echarts -}}
|
||||
{{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.echartsMacaronsJS | default "lib/echarts/macarons.js" -}}
|
||||
{{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Mapbox GL */ -}}
|
||||
{{- if (.Scratch.Get "this").mapbox -}}
|
||||
{{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.min.css" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "source" "lib/mapbox-gl/mapbox-gl-language.js" "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- 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 -}}
|
||||
|
||||
@@ -149,23 +147,23 @@
|
||||
{{- if (.Scratch.Get "this").music -}}
|
||||
{{- /* APlayer */ -}}
|
||||
{{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}}
|
||||
{{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* MetingJS */ -}}
|
||||
{{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Cookie Consent */ -}}
|
||||
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
|
||||
{{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}}
|
||||
{{- $cookieconsentConfig = .Site.Params.cookieconsent | merge $cookieconsentConfig -}}
|
||||
{{- $cookieconsentConfig = dict "message" ($cookieconsentConfig.content.message | default (T "cookieconsentMessage")) "dismiss" ($cookieconsentConfig.content.dismiss | default (T "cookieconsentDismiss")) "link" ($cookieconsentConfig.content.link | default (T "cookieconsentLink")) | dict "content" | merge $cookieconsentConfig -}}
|
||||
@@ -173,26 +171,29 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.css -}}
|
||||
{{- dict "source" . "fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.js -}}
|
||||
{{- dict "source" . "fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with (.Scratch.Get "this").styleArr -}}
|
||||
{{- delimit . "" | dict "content" | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $content := delimit . "" -}}
|
||||
{{- $path := substr (md5 $content) 0 6 | printf "css/%v" -}}
|
||||
{{- $options := printf "%v.min.css" $path | dict "targetPath" -}}
|
||||
{{- dict "Content" $content "Path" (printf "%v.scss" $path) "ToCSS" $options | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Config script */ -}}
|
||||
{{- $config | jsonify | printf "window.config=%s;" | dict "content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config | jsonify | printf "window.config=%s;" | dict "Content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* Theme script */ -}}
|
||||
{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "js/theme.min.js" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
|
||||
|
||||
{{- with (.Scratch.Get "this").scriptArr -}}
|
||||
{{- delimit . "\n" | dict "content" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- delimit . "\n" | dict "Content" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range (.Scratch.Get "this").style -}}
|
||||
@@ -203,6 +204,4 @@
|
||||
{{- partial "plugin/script.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Scratch.Get "analytics" -}}
|
||||
{{- partial "plugin/analytics.html" . -}}
|
||||
{{- end -}}
|
||||
{{- partial "plugin/analytics.html" . -}}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
{{- if $disqus.enable -}}
|
||||
<div id="disqus_thread" class="comment"></div>
|
||||
{{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}}
|
||||
{{- dict "source" $source "defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript">Disqus</a>.
|
||||
</noscript>
|
||||
@@ -21,9 +21,9 @@
|
||||
{{- if $gitalk.enable -}}
|
||||
<div id="gitalk" class="comment"></div>
|
||||
{{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}}
|
||||
{{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk"></a>Gitalk</a>.
|
||||
@@ -35,9 +35,9 @@
|
||||
{{- if $valine.enable -}}
|
||||
<div id="valine" class="comment"></div>
|
||||
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
|
||||
{{- dict "source" "lib/valine/valine.scss" "toCSS" $options | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" "lib/valine/valine.scss" "ToCSS" $options | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}}
|
||||
{{- with $valine.avatar -}}
|
||||
{{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}}
|
||||
@@ -68,7 +68,7 @@
|
||||
data-numposts="{{ $facebook.numPosts }}"
|
||||
></div>
|
||||
{{- $source := printf "https://connect.facebook.net/%v/sdk.js#xfbml=1&version=v5.0&appId=%v&autoLogAppEvents=1" ($facebook.languageCode | default (T "facebookLanguageCode")) $facebook.appId -}}
|
||||
{{- dict "source" $source "defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/"></a>Facebook</a>.
|
||||
</noscript>
|
||||
@@ -95,7 +95,7 @@
|
||||
{{- if $telegram.outlined -}}
|
||||
{{- $attr = printf `%v data-outlined="1"` $attr -}}
|
||||
{{- end -}}
|
||||
{{- dict "source" "https://comments.app/js/widget.js?2" "defer" true "attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "https://comments.app/js/widget.js?2" "Defer" true "Attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
|
||||
</noscript>
|
||||
@@ -105,7 +105,7 @@
|
||||
{{- $commento := $comment.commento | default dict -}}
|
||||
{{- if $commento.enable -}}
|
||||
<div id="commento"></div>
|
||||
{{- dict "source" "https://cdn.commento.io/js/commento.js" "defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "https://cdn.commento.io/js/commento.js" "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>.
|
||||
</noscript>
|
||||
|
||||
16
layouts/partials/function/resource.html
Normal file
16
layouts/partials/function/resource.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{- $resource := 0 -}}
|
||||
{{- $url := urls.Parse .Path -}}
|
||||
{{- if not $url.Host | and $url.Path | and (strings.HasSuffix $url.Path "/" | not) -}}
|
||||
{{- if .Resources -}}
|
||||
{{- with .Resources.GetMatch $url.Path -}}
|
||||
{{- $resource = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not $resource -}}
|
||||
{{- with resources.Get $url.Path -}}
|
||||
{{- $resource = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $resource -}}
|
||||
@@ -31,21 +31,21 @@
|
||||
|
||||
{{- /* normalize.css */ -}}
|
||||
{{- $source := $cdn.normalizeCSS | default "lib/normalize/normalize.min.css" -}}
|
||||
{{- $style := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{- /* style.min.css */ -}}
|
||||
{{- $style := dict "source" "css/style.scss" "fingerprint" $fingerprint -}}
|
||||
{{- $style := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}}
|
||||
{{- $options := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
|
||||
{{- $style = dict "context" . "toCSS" $options | merge $style -}}
|
||||
{{- $style = dict "Context" . "ToCSS" $options | merge $style -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{- /* Font Awesome */ -}}
|
||||
{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}}
|
||||
{{- $style := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{- /* Animate.css */ -}}
|
||||
{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}}
|
||||
{{- $style := dict "source" $source "fingerprint" $fingerprint -}}
|
||||
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
|
||||
{{- with .Site.Params.header.title -}}
|
||||
{{- with .logo -}}
|
||||
{{- dict "src" . "alt" $.Site.Title "class" "logo" | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
{{- with .pre -}}
|
||||
<span class="header-title-pre">{{ . | safeHTML }}</span>
|
||||
@@ -89,7 +89,7 @@
|
||||
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
|
||||
{{- with .Site.Params.header.title -}}
|
||||
{{- with .logo -}}
|
||||
{{- dict "src" . "alt" $.Site.Title "class" "logo" | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
{{- with .pre -}}
|
||||
<span class="header-title-pre">{{ . | safeHTML }}</span>
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
|
||||
{{- dict "src" $avatar "alt" .Name | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
|
||||
</a>
|
||||
{{- else -}}
|
||||
{{- dict "src" $avatar | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
@@ -47,18 +47,41 @@
|
||||
{{- $social := $key | lower | index $socialMap | default dict -}}
|
||||
{{- if $value -}}
|
||||
{{- if reflect.IsMap $value -}}
|
||||
{{- $social = $value | merge $social -}}
|
||||
{{- with $value.weight -}}
|
||||
{{- $social = dict "Weight" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.prefix -}}
|
||||
{{- $social = dict "Prefix" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.template -}}
|
||||
{{- $social = dict "Template" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.id -}}
|
||||
{{- $social = dict "Id" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.url -}}
|
||||
{{- $social = dict "Url" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.title -}}
|
||||
{{- $social = dict "Title" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.newtab -}}
|
||||
{{- $social = dict "Newtab" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.icon -}}
|
||||
{{- $social = dict "Icon" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- else if ne $value true -}}
|
||||
{{- $social = dict "id" $value | merge $social -}}
|
||||
{{- $social = dict "Id" $value | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- if $social.icon.simpleicons -}}
|
||||
{{- if $social.Icon.Simpleicons -}}
|
||||
{{- $prefix := ($.Scratch.Get "cdn" | default dict).simpleIconsPrefix -}}
|
||||
{{- $social = dict "prefix" $prefix | dict "icon" | merge $social -}}
|
||||
{{- $social = dict "Prefix" $prefix | dict "Icon" | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- $socialArr = $socialArr | append $social -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- range sort $socialArr "weight" -}}
|
||||
{{- range sort $socialArr "Weight" -}}
|
||||
{{- partial "plugin/social.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
{{- if .enable -}}
|
||||
{{- $analytics := .Scratch.Get "analytics" | default dict -}}
|
||||
|
||||
{{- if $analytics.enable -}}
|
||||
{{- /* Google Analytics */ -}}
|
||||
{{- with .google.id -}}
|
||||
{{- with $analytics.google.id -}}
|
||||
<script type="text/javascript">
|
||||
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());
|
||||
gtag('config', '{{ . }}'{{ if $.google.anonymizeIP }}, { 'anonymize_ip': true }{{ end }});
|
||||
gtag('config', '{{ . }}'{{ if $analytics.google.anonymizeIP }}, { 'anonymize_ip': true }{{ end }});
|
||||
</script>
|
||||
{{- printf "https://www.googletagmanager.com/gtag/js?id=%v" . | dict "async" true "source" | partial "plugin/script.html" -}}
|
||||
{{- printf "https://www.googletagmanager.com/gtag/js?id=%v" . | dict "Async" true "Source" | partial "plugin/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Fathom Analytics */ -}}
|
||||
{{- with .fathom.id -}}
|
||||
{{- with $analytics.fathom.id -}}
|
||||
<script type="text/javascript">
|
||||
window.fathom=window.fathom||function(){(fathom.q=fathom.q||[]).push(arguments);};
|
||||
fathom('set', 'siteId', '{{ . }}');
|
||||
fathom('trackPageview');
|
||||
</script>
|
||||
{{- dict "source" ($.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "async" true "attr" "id=fathom-script" | partial "plugin/script.html" -}}
|
||||
{{- dict "Source" ($analytics.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "Async" true "Attr" "id=fathom-script" | partial "plugin/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with $features | uniq -}}
|
||||
{{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "Source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* object-fit-images */ -}}
|
||||
{{- if $compatibility.objectFit -}}
|
||||
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
{{- with .class -}}
|
||||
{{- with .Class -}}
|
||||
<i class="{{ . }}"></i>
|
||||
{{- else -}}
|
||||
{{- $src := .src -}}
|
||||
{{- with .simpleicons -}}
|
||||
{{- $prefix := "lib/simple-icons/icons" -}}
|
||||
{{- with $.prefix -}}
|
||||
{{- $prefix = . -}}
|
||||
{{- end -}}
|
||||
{{- $prefix = $prefix | strings.TrimSuffix "/" -}}
|
||||
{{- $src := .Src -}}
|
||||
{{- with .Simpleicons -}}
|
||||
{{- $prefix := $.Prefix | default "lib/simple-icons/icons" | strings.TrimSuffix "/" -}}
|
||||
{{- $src = printf "%v/%v.svg" $prefix . -}}
|
||||
{{- end -}}
|
||||
{{- if (urls.Parse $src).Host | not -}}
|
||||
|
||||
@@ -1,28 +1,38 @@
|
||||
{{- /* lazysizes and lightgallery.js */ -}}
|
||||
{{- $loading := resources.Get "svg/loading/normal.svg" | minify -}}
|
||||
{{- $small := .src_s | default .src -}}
|
||||
{{- $large := .src_l | default .src -}}
|
||||
{{- $alt := .alt | default (relURL .src) -}}
|
||||
{{- if .linked -}}
|
||||
<a class="lightgallery" href="{{ $large | relURL }}" title="{{ .title | default $alt }}" data-thumbnail="{{ $small | relURL }}"{{ with .caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.alt }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .rel }} rel="{{ . }}"{{ end }}>
|
||||
{{- $src := .Src -}}
|
||||
{{- with dict "Path" .Src "Resources" .Resources | partial "function/resource.html" -}}
|
||||
{{- $src = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $small := .SrcSmall | default $src -}}
|
||||
{{- with dict "Path" .SrcSmall "Resources" .Resources | partial "function/resource.html" -}}
|
||||
{{- $small = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $large := .SrcLarge | default $src -}}
|
||||
{{- with dict "Path" .SrcLarge "Resources" .Resources | partial "function/resource.html" -}}
|
||||
{{- $large = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $alt := .Alt | default $src -}}
|
||||
{{- $loading := resources.Get "svg/loading.svg" | minify -}}
|
||||
{{- if .Linked -}}
|
||||
<a class="lightgallery" href="{{ $large | safeURL }}" title="{{ .Title | default $alt }}" data-thumbnail="{{ $small | safeURL }}"{{ with .Caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.Title }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .Rel }} rel="{{ . }}"{{ end }}>
|
||||
<img
|
||||
class="lazyload{{ with .class }} {{ . }}{{ end }}"
|
||||
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
|
||||
src="{{ $loading.RelPermalink }}"
|
||||
data-src="{{ .src | relURL }}"
|
||||
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
|
||||
data-src="{{ .Src | safeURL }}"
|
||||
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
|
||||
data-sizes="auto"
|
||||
alt="{{ $alt }}"{{ with .height }} height="{{ . }}"{{ end }}{{ with .width }} width="{{ . }}"{{ end }} />
|
||||
alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
|
||||
</a>
|
||||
{{- else -}}
|
||||
{{- if not .large -}}
|
||||
{{- $loading = resources.Get "svg/loading/small.svg" | minify -}}
|
||||
{{- end -}}
|
||||
<img
|
||||
class="lazyload{{ with .class }} {{ . }}{{ end }}"
|
||||
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
|
||||
src="{{ $loading.RelPermalink }}"
|
||||
data-src="{{ .src | relURL }}"
|
||||
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
|
||||
data-src="{{ .Src | safeURL }}"
|
||||
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
|
||||
data-sizes="auto"
|
||||
alt="{{ $alt }}"
|
||||
title="{{ .title | default $alt }}"{{ with .height }} height="{{ . }}"{{ end }}{{ with .width }} width="{{ . }}"{{ end }} />
|
||||
title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{- $rel := "" -}}
|
||||
<a href="{{ .href | safeURL }}"{{ with .title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .href).Host | or .newtab }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .rel }} {{ . }}{{ end }}"{{ with .class }} class="{{ . }}"{{ end }}>
|
||||
{{- with .icon -}}
|
||||
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .Destination).Host | or .Newtab }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"{{ with .Class }} class="{{ . }}"{{ end }}>
|
||||
{{- with .Icon -}}
|
||||
{{- partial "plugin/icon.html" . -}}
|
||||
{{- end -}}
|
||||
{{- with .content -}}
|
||||
{{- with .Content -}}
|
||||
{{- . | safeHTML -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
@@ -1,25 +1,25 @@
|
||||
{{- if .content -}}
|
||||
{{- if .Content -}}
|
||||
<script type="text/javascript">
|
||||
{{- .content | safeJS -}}
|
||||
{{- .Content | safeJS -}}
|
||||
</script>
|
||||
{{- else if strings.HasPrefix .source "<script" -}}
|
||||
{{- safeHTML .source -}}
|
||||
{{- else if strings.HasPrefix .Source "<script" -}}
|
||||
{{- safeHTML .Source -}}
|
||||
{{- else -}}
|
||||
{{- $src := .source -}}
|
||||
{{- $integrity := .integrity -}}
|
||||
{{- $src := .Source -}}
|
||||
{{- $integrity := .Integrity -}}
|
||||
{{- if (urls.Parse $src).Host | not -}}
|
||||
{{- $res := resources.Get $src -}}
|
||||
{{- with .template -}}
|
||||
{{- $res = $res | resources.ExecuteAsTemplate . $.context -}}
|
||||
{{- $resource := resources.Get $src -}}
|
||||
{{- with .Template -}}
|
||||
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
|
||||
{{- end -}}
|
||||
{{- if .minify -}}
|
||||
{{- $res = $res | minify -}}
|
||||
{{- if .Minify -}}
|
||||
{{- $resource = $resource | minify -}}
|
||||
{{- end -}}
|
||||
{{- with .fingerprint -}}
|
||||
{{- $res = $res | fingerprint . -}}
|
||||
{{- $integrity = $res.Data.Integrity -}}
|
||||
{{- with .Fingerprint -}}
|
||||
{{- $resource = $resource | fingerprint . -}}
|
||||
{{- $integrity = $resource.Data.Integrity -}}
|
||||
{{- end -}}
|
||||
{{- $src = $res.RelPermalink -}}
|
||||
{{- $src = $resource.RelPermalink -}}
|
||||
{{- end -}}
|
||||
<script type="text/javascript" src="{{ $src }}"{{ if .crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ if .async }} async{{ end }}{{ if .defer }} defer{{ end }}{{ with .attr }} {{ . | safeHTMLAttr }}{{ end }}></script>
|
||||
<script type="text/javascript" src="{{ $src }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ if .Async }} async{{ end }}{{ if .Defer }} defer{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}></script>
|
||||
{{- end -}}
|
||||
|
||||
@@ -4,196 +4,196 @@
|
||||
{{- /* 001: Twitter */ -}}
|
||||
{{- if $share.Twitter -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Twitter" data-sharer="twitter" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.tags }} data-hashtags="{{ delimit . `,` }}"{{ end }}>
|
||||
{{- dict "class" "fab fa-twitter fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-twitter fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 002: Facebook */ -}}
|
||||
{{- if $share.Facebook -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Facebook" data-sharer="facebook" data-url="{{ .Permalink }}"{{ with .Params.tags }} data-hashtag="{{ index . 0 }}"{{ end }}>
|
||||
{{- dict "class" "fab fa-facebook-square fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-facebook-square fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 003: Linkedin */ -}}
|
||||
{{- if $share.Linkedin -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Linkedin" data-sharer="linkedin" data-url="{{ .Permalink }}">
|
||||
{{- dict "class" "fab fa-linkedin fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-linkedin fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 004: WhatsApp */ -}}
|
||||
{{- if $share.Whatsapp -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} WhatsApp" data-sharer="whatsapp" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-web>
|
||||
{{- dict "class" "fab fa-whatsapp fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-whatsapp fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 005: Viber */ -}}
|
||||
{{- if $share.Viber -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Viber" data-sharer="viber" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "class" "fab fa-viber fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-viber fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 006: Pinterest */ -}}
|
||||
{{- if $share.Pinterest -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pinterest" data-sharer="pinterest" data-url="{{ .Permalink }}"{{ with .Description }} data-description="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
|
||||
{{- dict "class" "fab fa-pinterest fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-pinterest fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 007: Tumblr */ -}}
|
||||
{{- if $share.Tumblr -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Tumblr" data-sharer="tumblr" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.tags }} data-tags="{{ delimit . `,` }}"{{ end }}>
|
||||
{{- dict "class" "fab fa-tumblr fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-tumblr fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 008: Hacker News */ -}}
|
||||
{{- if $share.Hackernews -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Hacker News" data-sharer="hackernews" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "class" "fab fa-hacker-news fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-hacker-news fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 009: Reddit */ -}}
|
||||
{{- if $share.Reddit -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Reddit" data-sharer="reddit" data-url="{{ .Permalink }}">
|
||||
{{- dict "class" "fab fa-reddit fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-reddit fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 010: VK */ -}}
|
||||
{{- if $share.VK -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} VK" data-sharer="vk" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
|
||||
{{- dict "class" "fab fa-vk fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-vk fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 011: Buffer */ -}}
|
||||
{{- if $share.Buffer -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Buffer" data-sharer="buffer" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-picture="{{ . }}"{{ end }}>
|
||||
{{- dict "class" "fab fa-buffer fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-buffer fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 012: Xing */ -}}
|
||||
{{- if $share.Xing -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Xing" data-sharer="xing" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "class" "fab fa-xing fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-xing fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 013: Line */ -}}
|
||||
{{- if $share.Line -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Line" data-sharer="line" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "simpleicons" "line" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
{{- dict "Simpleicons" "line" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 014: Instapaper */ -}}
|
||||
{{- if $share.Instapaper -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Instapaper" data-sharer="instapaper" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- dict "simpleicons" "instapaper" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
{{- dict "Simpleicons" "instapaper" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 015: Pocket */ -}}
|
||||
{{- if $share.Pocket -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pocket" data-sharer="pocket" data-url="{{ .Permalink }}">
|
||||
{{- dict "class" "fab fa-get-pocket fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-get-pocket fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 016: Digg */ -}}
|
||||
{{- if $share.Digg -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Digg" data-sharer="digg" data-url="{{ .Permalink }}">
|
||||
{{- dict "class" "fab fa-digg fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-digg fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 017: StumbleUpon */ -}}
|
||||
{{- if $share.Stumbleupon -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} StumbleUpon" data-sharer="stumbleupon" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "class" "fab fa-stumbleupon fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-stumbleupon fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 018: Flipboard */ -}}
|
||||
{{- if $share.Flipboard -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Flipboard" data-sharer="flipboard" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "class" "fab fa-flipboard fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-flipboard fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 019: 微博 */ -}}
|
||||
{{- if $share.Weibo -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} 微博" data-sharer="weibo" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}{{ with .Site.Params.Social.Weibo }} data-ralateuid="{{ . }}"{{ end }}>
|
||||
{{- dict "class" "fab fa-weibo fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-weibo fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 020: 人人 */ -}}
|
||||
{{- if $share.Renren -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} 人人" data-sharer="renren" data-url="{{ .Permalink }}">
|
||||
{{- dict "class" "fab fa-renren fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-renren fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 021: Myspace */ -}}
|
||||
{{- if $share.Myspace -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Myspace" data-sharer="myspace" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- dict "simpleicons" "myspace" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
{{- dict "Simpleicons" "myspace" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 022: Blogger */ -}}
|
||||
{{- if $share.Blogger -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Blogger" data-sharer="blogger" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- dict "class" "fab fa-blogger fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-blogger fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 023: 百度 */ -}}
|
||||
{{- if $share.Baidu -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "simpleicons" "baidu" "prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
{{- dict "Simpleicons" "baidu" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 024: OK.RU */ -}}
|
||||
{{- if $share.Odnoklassniki -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} OK.RU" data-sharer="okru" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "class" "fab fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 025: Evernote */ -}}
|
||||
{{- if $share.Evernote -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Evernote" data-sharer="evernote" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "class" "fab fa-evernote fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-evernote fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 026: Skype */ -}}
|
||||
{{- if $share.Skype -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Skype" data-sharer="skype" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "class" "fab fa-skype fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-skype fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 027: Trello */ -}}
|
||||
{{- if $share.Trello -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Trello" data-sharer="trello" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- dict "class" "fab fa-trello fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-trello fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 028: Mix */ -}}
|
||||
{{- if $share.Mix -}}
|
||||
<a href="//mix.com/add?url={{ .Permalink }}&description={{ .Title }}" target="_blank" title="{{ T `shareOn` }} Mix">
|
||||
{{- dict "class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- dict "Class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{{- $href := "" -}}
|
||||
{{- with .url -}}
|
||||
{{- $href = . | relLangURL -}}
|
||||
{{- $destination := "" -}}
|
||||
{{- with .Url -}}
|
||||
{{- $destination = . | relLangURL -}}
|
||||
{{- else -}}
|
||||
{{- $template := .template | default "%v" -}}
|
||||
{{- with .prefix -}}
|
||||
{{- $template := .Template | default "%v" -}}
|
||||
{{- with .Prefix -}}
|
||||
{{- $template = . | strings.TrimSuffix "/" | printf "%v/%%v" -}}
|
||||
{{- end -}}
|
||||
{{- $href = printf (string $template) .id -}}
|
||||
{{- $destination = printf (string $template) .Id -}}
|
||||
{{- end -}}
|
||||
{{- dict "href" $href "rel" "me" | merge . | partial "plugin/link.html" -}}
|
||||
{{- dict "Destination" $destination "Rel" "me" | merge . | partial "plugin/link.html" -}}
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
{{- if .content -}}
|
||||
<style>
|
||||
{{- .content | safeCSS -}}
|
||||
</style>
|
||||
{{- else if strings.HasPrefix .source "<link" -}}
|
||||
{{- safeHTML .source -}}
|
||||
{{- if strings.HasPrefix .Source "<link" -}}
|
||||
{{- safeHTML .Source -}}
|
||||
{{- else -}}
|
||||
{{- $href := .source -}}
|
||||
{{- $integrity := .integrity -}}
|
||||
{{- if (urls.Parse $href).Host | not -}}
|
||||
{{- $res := resources.Get $href -}}
|
||||
{{- with .template -}}
|
||||
{{- $res = $res | resources.ExecuteAsTemplate . $.context -}}
|
||||
{{- end -}}
|
||||
{{- with .toCSS -}}
|
||||
{{- $options := . | merge (dict "outputStyle" "compressed") -}}
|
||||
{{- $res = $res | toCSS $options -}}
|
||||
{{- end -}}
|
||||
{{- if .minify -}}
|
||||
{{- $res = $res | minify -}}
|
||||
{{- end -}}
|
||||
{{- with .fingerprint -}}
|
||||
{{- $res = $res | fingerprint . -}}
|
||||
{{- $integrity = $res.Data.Integrity -}}
|
||||
{{- end -}}
|
||||
{{- $href = $res.RelPermalink -}}
|
||||
{{- $href := .Source -}}
|
||||
{{- $integrity := .Integrity -}}
|
||||
{{- $resource := 0 -}}
|
||||
{{- if $href | and (not (urls.Parse $href).Host) -}}
|
||||
{{- $resource = resources.Get $href -}}
|
||||
{{- end -}}
|
||||
<link rel="stylesheet" href="{{ $href }}"{{ if .crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ with .attr }} {{ . | safeHTMLAttr }}{{ end }}>
|
||||
{{- with .Content -}}
|
||||
{{- $resource = resources.FromString $.Path . -}}
|
||||
{{- end -}}
|
||||
{{- if $resource -}}
|
||||
{{- with .Template -}}
|
||||
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
|
||||
{{- end -}}
|
||||
{{- with .ToCSS -}}
|
||||
{{- $options := . | merge (dict "outputStyle" "compressed") -}}
|
||||
{{- $resource = $resource | toCSS $options -}}
|
||||
{{- end -}}
|
||||
{{- if .Minify -}}
|
||||
{{- $resource = $resource | minify -}}
|
||||
{{- end -}}
|
||||
{{- with .Fingerprint -}}
|
||||
{{- $resource = $resource | fingerprint . -}}
|
||||
{{- $integrity = $resource.Data.Integrity -}}
|
||||
{{- end -}}
|
||||
{{- $href = $resource.RelPermalink -}}
|
||||
{{- end -}}
|
||||
<link rel="stylesheet" href="{{ $href }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}>
|
||||
{{- end -}}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
|
||||
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
|
||||
<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 -}}
|
||||
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
</span>
|
||||
|
||||
@@ -64,9 +64,13 @@
|
||||
</div>
|
||||
|
||||
{{- /* Featured image */ -}}
|
||||
{{- with $params.featuredimage -}}
|
||||
{{- $image := $params.featuredimage -}}
|
||||
{{- with .Resources.GetMatch "featured-image" -}}
|
||||
{{- $image = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- with $image -}}
|
||||
<div class="featured-image">
|
||||
{{- dict "src" . "alt" $.Description "large" true | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
{{- $options := cond .IsNamedParams (.Get "src") (.Get 0) | dict "src" -}}
|
||||
{{- $options = cond .IsNamedParams (.Get "alt") (.Get 1) | .Page.RenderString | dict "alt" | merge $options -}}
|
||||
{{- $options := cond .IsNamedParams (.Get "src") (.Get 0) | dict "Src" -}}
|
||||
{{- $options = cond .IsNamedParams (.Get "alt") (.Get 1) | .Page.RenderString | dict "Alt" | merge $options -}}
|
||||
{{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}}
|
||||
{{- $options = dict "caption" $caption | merge $options -}}
|
||||
{{- $options = dict "Caption" $caption | merge $options -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $options = dict "title" (.Get "title") | merge $options -}}
|
||||
{{- $options = dict "src_s" (.Get "src_s") | merge $options -}}
|
||||
{{- $options = dict "src_l" (.Get "src_l") | merge $options -}}
|
||||
{{- $options = dict "height" (.Get "height") | merge $options -}}
|
||||
{{- $options = dict "width" (.Get "width") | merge $options -}}
|
||||
{{- $options = dict "large" (.Get "large") | merge $options -}}
|
||||
{{- $options = .Get "linked" | ne false | dict "linked" | merge $options -}}
|
||||
{{- $options = dict "rel" (.Get "rel") | merge $options -}}
|
||||
{{- $options = dict "Title" (.Get "title") | merge $options -}}
|
||||
{{- $options = dict "SrcSmall" (.Get "src_s") | merge $options -}}
|
||||
{{- $options = dict "SrcLarge" (.Get "src_l") | merge $options -}}
|
||||
{{- $options = dict "Height" (.Get "height") | merge $options -}}
|
||||
{{- $options = dict "Width" (.Get "width") | merge $options -}}
|
||||
{{- $options = .Get "linked" | ne false | dict "Linked" | merge $options -}}
|
||||
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
|
||||
{{- else -}}
|
||||
{{- $options = cond $caption true false | dict "linked" | merge $options -}}
|
||||
{{- $options = cond $caption true false | dict "Linked" | merge $options -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $options = dict "Resources" .Page.Resources | merge $options -}}
|
||||
|
||||
{{- with $caption -}}
|
||||
<figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}>
|
||||
{{- partial "plugin/image.html" $options -}}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
{{- $options := cond .IsNamedParams (.Get "href") (.Get 0) | dict "href" -}}
|
||||
{{- $destination := cond .IsNamedParams (.Get "href") (.Get 0) -}}
|
||||
{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "Destination" $destination -}}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $options = dict "content" (.Get "content") | merge $options -}}
|
||||
{{- $options = dict "title" (.Get "title") | merge $options -}}
|
||||
{{- $options = dict "class" (.Get "class") | merge $options -}}
|
||||
{{- $options = dict "rel" (.Get "rel") | merge $options -}}
|
||||
{{- $options = dict "Content" (.Get "content") | merge $options -}}
|
||||
{{- $options = dict "Title" (.Get "title") | merge $options -}}
|
||||
{{- $options = dict "Class" (.Get "class") | merge $options -}}
|
||||
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
|
||||
{{- else -}}
|
||||
{{- $options = dict "content" (.Get 1 | default (.Get 0)) | merge $options -}}
|
||||
{{- $options = dict "title" (.Get 2) | merge $options -}}
|
||||
{{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}}
|
||||
{{- $options = dict "Title" (.Get 2) | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
|
||||
@@ -2,7 +2,15 @@
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $theme = .Get "theme" | default $theme -}}
|
||||
{{- if .Get "url" -}}
|
||||
<meting-js url="{{ .Get `url` }}" name="{{ .Get `name` }}" artist="{{ .Get `artist` }}" cover="{{ .Get `cover` }}" theme="{{ $theme }}"
|
||||
{{- $url := .Get "url" -}}
|
||||
{{- with dict "Path" $url "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $cover := .Get "cover" -}}
|
||||
{{- with dict "Path" $cover "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $cover = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<meting-js url="{{ $url }}" name="{{ .Get `name` }}" artist="{{ .Get `artist` }}" cover="{{ $cover }}" theme="{{ $theme }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
|
||||
@@ -4,8 +4,5 @@
|
||||
{{- printf `<%v id="%v">%v</%v>` $tag $id $content $tag | safeHTML -}}
|
||||
|
||||
{{- $style := .Get 0 | printf "#%v{%v}" $id -}}
|
||||
{{- $path := printf "style/%v/%v" (md5 .Page.RelPermalink) $id -}}
|
||||
{{- $res := resources.FromString (printf "%v.scss" $path) $style -}}
|
||||
{{- $res = $res | toCSS (dict "targetPath" (printf "%v.css" $path) "outputStyle" "compressed") -}}
|
||||
{{- $styleArr := (.Page.Scratch.Get "this").styleArr | default slice -}}
|
||||
{{- $styleArr | append $res.Content | .Page.Scratch.SetInMap "this" "styleArr" -}}
|
||||
{{- $styleArr | append $style | .Page.Scratch.SetInMap "this" "styleArr" -}}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
|
||||
{{- $pathTemplate := cond .Site.IsMultiLingual (printf "svg/version/%%v-%%v.%v.svg" .Page.Language.Lang) "svg/version/%v-%v.svg" -}}
|
||||
{{- $path := printf $pathTemplate $version $type -}}
|
||||
{{- $res := resources.Get "svg/version.template.svg" -}}
|
||||
{{- $res = $res | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
|
||||
{{- $resource := resources.Get "svg/version.template.svg" -}}
|
||||
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
|
||||
{{- $alt := printf "LoveIt %v | %v" $label $version -}}
|
||||
<a href="{{ $url }}" rel="noopener noreffer" target="_blank">
|
||||
{{- dict "src" $res.RelPermalink "alt" $alt "class" "version" | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
|
||||
</a>
|
||||
Reference in New Issue
Block a user