mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2025-08-10 17:31:35 -05:00
WIP: use template to generate the individual share buttons
This commit is contained in:
@@ -1,4 +1,22 @@
|
|||||||
|
{{ define "_partials/share-button.html" }}
|
||||||
|
<a class="{{ .ShortName }}-share"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
aria-label="{{ i18n (printf "aria_share_%s" .ShortName) }}"
|
||||||
|
onclick="share_event('{{ .ProperName }}');"
|
||||||
|
href="{{ .URL }}">
|
||||||
|
{{- partial "icon.html" (or .IconName .ShortName) -}}
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<div class="share-buttons">
|
<div class="share-buttons">
|
||||||
|
{{ $services := dict
|
||||||
|
"twitter" (dict "ProperName" "Twitter" "URL" (printf "https://twitter.com/intent/tweet?url=%s&text=%s&via=bbaovanc" .Permalink .Title))
|
||||||
|
}}
|
||||||
|
{{ range $name, $info := $services }}
|
||||||
|
{{ $data := merge $info (dict "ShortName" $name) }}
|
||||||
|
{{ partial "share-button.html" $data }}
|
||||||
|
{{ end }}
|
||||||
{{ if .Site.Params.shareButtons.twitter }}
|
{{ if .Site.Params.shareButtons.twitter }}
|
||||||
<a class="twitter-share"
|
<a class="twitter-share"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
Reference in New Issue
Block a user