From b92314038229287e396faba9ed30e3f2546540c9 Mon Sep 17 00:00:00 2001 From: Thomas Helmke Date: Wed, 27 May 2020 20:05:37 +0200 Subject: [PATCH] fixed missing changes from upstream --- layouts/partials/components/post-share.html | 36 ++++++--------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/layouts/partials/components/post-share.html b/layouts/partials/components/post-share.html index c854e01a..7cfaa24b 100644 --- a/layouts/partials/components/post-share.html +++ b/layouts/partials/components/post-share.html @@ -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 -}} @@ -50,8 +32,8 @@ {{ if .Site.Params.shareOnTwitter }}
{{ $url := (printf `https://twitter.com/share?url=%s&text=%s&hashtags=%s&via=%s` .Permalink .Title ($hashtags.Get "tags" | default "") .Site.Params.siteTwitter) }} - - {{- $icon | safeHTML -}} + + {{- partial "utils/icon.html" (dict "$" . "name" "twitter" "class" "twitter-icon") -}}
{{ end }} @@ -59,8 +41,8 @@ {{ if .Site.Params.shareOnFacebook }}
{{ $url := (printf `https://www.facebook.com/sharer/sharer.php?u=%s&hashtag=%s` .Permalink ($hashtags.Get "firsttag" | default "")) }} - - {{- $icon | safeHTML -}} + + {{- partial "utils/icon.html" (dict "$" . "name" "facebook" "class" "facebook-icon") -}}
{{ end }} @@ -133,4 +115,4 @@ -{{ end }} +{{ end }} \ No newline at end of file