blog/layouts/partials/social-share.html

37 lines
2.2 KiB
HTML

<button id="share-btn" class="hdr-btn" title="{{i18n "share"}}">{{- partial "svg.html" (dict "context" . "name" "share") -}}</button>
<div id="share-links" class="animated fast">
{{ $title := .Title }}
{{ $url := printf "%s" .Permalink }}
{{ $author := (.Params.author | default .Site.Params.author.name) }}
{{ $summary := print $title ", by " $author "\n\n" .Params.description "\n" }}
<ul>
<li>
<a href="#" rel="noreferrer noopener"
target="mastodon"
data-prompt="Please tell me your Mastodon instance"
data-edittext="✏️"
data-editlabel="Edit your Mastodon instance"
class="mastodon-share">
Share to Mastodon
</a>
{{ $mastodon_share := resources.Get "js/mastodon-share.js" | js.Build "mastodon-share.js" }}
<script src="{{ $mastodon_share.RelPermalink }}" defer></script>
</li>
<li>
<a href="https://twitter.com/intent/tweet?hashtags=hermit2&amp;url={{ .Permalink }}&amp;text={{ .Title }}" target="_blank" rel="noopener" aria-label="Share on X">{{- partial "svg.html" (dict "context" . "name" "x") -}}</a>
</li>
<li>
<a href="https://facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" rel="noopener" aria-label="Share on Facebook">{{- partial "svg.html" (dict "context" . "name" "facebook") -}}</a>
</li>
<li>
<a href="mailto:?subject={{ .Title }}&amp;body={{ .Permalink }}" target="_self" rel="noopener" aria-label="Share on Email">{{- partial "svg.html" (dict "context" . "name" "email") -}}</a>
</li>
<li>
<a href="https://www.linkedin.com/shareArticle?mini=true&amp;url={{ $url }}&amp;source={{ .Site.BaseURL }}&amp;title={{ $title }}&amp;summary={{ $summary }}" target="_blank" rel="noopener" aria-label="Share on LinkedIn">{{- partial "svg.html" (dict "context" . "name" "linkedin") -}}</a>
</li>
<li>
<a href="#" onclick="linkShare({{ $title }},{{ $url }},{{ $summary }}); return false;" target="_self" rel="noopener" aria-label="Copy Link">{{- partial "svg.html" (dict "context" . "name" "share_2") -}}</a>
</li>
</ul>
</div>