{{ if and .Site.Params.enablePostShare (.Params.share | default .Site.Params.displayPostShare) }} {{- $title := (partial "utils/title.html" (dict "$" . "title" .Title)).rawTitle -}} {{- $description := .Description | default (partial "utils/summary.html" .) | default .Site.Params.siteDescription | plainify | htmlUnescape -}} {{- $images := partial "utils/images.html" . -}} {{- $images = union $images (slice (.Site.Params.siteLogo | absURL)) -}} {{- $images = index $images 0 -}} {{- $hashtags := newScratch -}} {{- with .Params.tags -}} {{- range . -}} {{- $tag := . -}} {{- $url := urls.Parse (. | urlize) -}} {{- $path := $url.Path -}} {{- with $.Site.GetPage (printf `/tags/%s` $path) -}} {{- $hashtags.Add "tags" (replace (.LinkTitle | default $tag) " " "") -}} {{- end -}} {{- $hashtags.Add "tags" "," -}} {{- end -}} {{- end -}} {{- $hashtags.Set "firsttag" "%23" -}} {{- $hashtags.Add "firsttag" (index (split ($hashtags.Get "tags") ",") 0) -}}
{{ if .Site.Params.displayShareOnText }}
{{ i18n "shareOn" }}
{{ end }}
{{ $ := . }} {{ range .Site.Params.postShareItems | default (slice "facebook" "mastodon" "fediverse" "twitter") }} {{ if eq . "twitter" }} {{ else if eq . "facebook" }} {{ else if or (eq . "mastodon") (eq . "fediverse") }} {{ $path := (strings.TrimPrefix "/" (printf `%s/fedishare.html` $.Site.LanguagePrefix)) -}} {{ $page := resources.Get "html/fedishare.html" -}} {{ $page := $page | resources.ExecuteAsTemplate $path ($.GetPage "/") -}} {{ $url := printf "%s#title=%s&description=%s&url=%s" $page.RelPermalink ($title | safeURL) ($description | safeURL) ($.Permalink | safeURL) -}} {{ if eq . "mastodon" -}} {{ else if eq . "fediverse" -}} {{ end -}} {{ else if eq . "linkedin" }} {{ else if eq . "telegram" }} {{ else if eq . "weibo" }} {{ else if eq . "douban" }} {{ else if eq . "qq" }} {{ else if eq . "qzone" }} {{ else if eq . "pocket" }} {{ else if eq . "hackernews" }} {{ else if eq . "qrcode" }} {{ else if eq . "email" }} {{ else }} {{ warnf "postShareItems option contains unknown share item '%s'" . }} {{ end }} {{ end }}
{{ end }}