Skip to content

Commit

Permalink
fixed missing changes from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Syralist committed May 27, 2020
1 parent bfd2815 commit b923140
Showing 1 changed file with 9 additions and 27 deletions.
36 changes: 9 additions & 27 deletions layouts/partials/components/post-share.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
{{ if and .Site.Params.enablePostShare (.Params.share | default .Site.Params.displayPostShare) }}

{{- $hashtags := newScratch -}}
{{ if .Site.Params.addHashtags }}
{{ with .Params.tags }}
{{ range . }}
{{ $url := urls.Parse (. | urlize) }}
{{ $path := $url.Path }}
{{ with $.Site.GetPage (printf `/tags/%s` $path) }}
{{ $hashtags.Add "tags" (replace (.LinkTitle | default .) " " "") }}
{{ end }}
{{ $hashtags.Add "tags" "," }}
{{ end }}
{{ end }}
{{ $hashtags.Set "firsttag" "%23" }}
{{ $hashtags.Add "firsttag" (index (split ($hashtags.Get "tags") ",") 0) }}
{{ end }}

{{- partial "utils/summary.html" . -}}
{{- $description := .Description | default (.Scratch.Get "summary") | default .Site.Params.siteDescription | plainify -}}
{{- $description := .Description | default (partial "utils/summary.html" .) | default .Site.Params.siteDescription | plainify -}}

{{- partial "utils/images.html" . -}}
{{- $images := .Scratch.Get "images" -}}
{{- $images := .Scratch.Add "images" (slice (.Site.Params.siteLogo | absURL)) -}}
{{- $images := (index (.Scratch.Get "images") 0) -}}
{{- $images := partial "utils/images.html" . -}}
{{- $images = union $images (slice (.Site.Params.siteLogo | absURL)) -}}
{{- $images = index $images 0 -}}

{{- $hashtags := newScratch -}}
{{- with .Params.tags -}}
Expand Down Expand Up @@ -50,17 +32,17 @@
{{ if .Site.Params.shareOnTwitter }}
<div class="share-item twitter">
{{ $url := (printf `https://twitter.com/share?url=%s&text=%s&hashtags=%s&via=%s` .Permalink .Title ($hashtags.Get "tags" | default "") .Site.Params.siteTwitter) }}
<a href="{{ $url | safeURL }}" title="{{ i18n "shareOnTitle" }}{{ i18n "twitter" }}" target="_blank" rel="noopener">
{{- $icon | safeHTML -}}
<a href="{{ $url }}" title="{{ i18n "shareOnTitle" }}{{ i18n "twitter" }}" target="_blank" rel="noopener">
{{- partial "utils/icon.html" (dict "$" . "name" "twitter" "class" "twitter-icon") -}}
</a>
</div>
{{ end }}

{{ if .Site.Params.shareOnFacebook }}
<div class="share-item facebook">
{{ $url := (printf `https://www.facebook.com/sharer/sharer.php?u=%s&hashtag=%s` .Permalink ($hashtags.Get "firsttag" | default "")) }}
<a href="{{ $url | safeURL }}" title="{{ i18n "shareOnTitle" }}{{ i18n "facebook" }}" target="_blank" rel="noopener">
{{- $icon | safeHTML -}}
<a href="{{ $url }}" title="{{ i18n "shareOnTitle" }}{{ i18n "facebook" }}" target="_blank" rel="noopener">
{{- partial "utils/icon.html" (dict "$" . "name" "facebook" "class" "facebook-icon") -}}
</a>
</div>
{{ end }}
Expand Down Expand Up @@ -133,4 +115,4 @@

</div>

{{ end }}
{{ end }}

0 comments on commit b923140

Please sign in to comment.