redesign 2023

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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