From 41d183a03456470e3f8f01ff1298e1662fca1ee4 Mon Sep 17 00:00:00 2001
From: Patrick Kollitsch <patrick@davids-neighbour.com>
Date: Thu, 19 Sep 2024 08:41:00 +0000
Subject: [PATCH] theme(fix): deprecated: .Site.Social
---
exampleSite/config.toml | 1 +
README.md | 1 +
layouts/partials/social-share.html | 6 ++++--
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 239ed21..e09b245 100644
--- a/README.md
+++ b/README.md
@@ -207,6 +207,7 @@
label: Facebook
follow: false
- name: twitter
+ username: theNewDynamic
url: https://twitter.com/theNewDynamic
label: TND Twitter
```
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index cd3325c..d264a2d 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -39,3 +39,4 @@
[[params.ananke_socials]]
name = "twitter"
url = "https://twitter.com/GoHugoIO"
+username = "GoHugoIO"
diff --git a/layouts/partials/social-share.html b/layouts/partials/social-share.html
index 14ae033..c1f0a0e 100644
--- a/layouts/partials/social-share.html
+++ b/layouts/partials/social-share.html
@@ -3,8 +3,10 @@
{{ $facebook_href := printf "https://www.facebook.com/sharer.php?u=%s" $url }}
{{ $twitter_href := printf "https://twitter.com/intent/tweet?url=%s&text=%s" $url $title }}
-{{ with site.Social.twitter }}
- {{ $twitter_href = printf "%s&via=%s" $twitter_href . }}
+
+{{ $twitterSetup := first 1 (where site.Params.ananke_socials "name" "twitter") }}
+{{ with index $twitterSetup 0 }}
+ {{ $twitter_href = printf "%s&via=%s" $twitter_href .username }}
{{ end }}
{{ $linkedin_href := printf "https://www.linkedin.com/shareArticle?mini=true&url=%s&title=%s" $url $title }}
{{ $hrefs := dict "facebook" $facebook_href "twitter" $twitter_href "linkedin" $linkedin_href }}
--
Gitblit v1.10.0