From 148010ddd597435078f5c73e091b6ba06409d6dd Mon Sep 17 00:00:00 2001 From: Dillon <dillonzq@outlook.com> Date: Fri, 7 Mar 2025 09:44:08 +0800 Subject: [PATCH] feat(share): support share on Threads and Diaspora (#943) --- README.md | 2 +- README.zh-cn.md | 2 +- exampleSite/content/about/index.en.md | 2 +- exampleSite/content/about/index.zh-cn.md | 2 +- .../theme-documentation-basics/index.en.md | 4 +- .../theme-documentation-basics/index.zh-cn.md | 2 + exampleSite/hugo.toml | 4 +- layouts/partials/plugin/share.html | 60 ++++++++++++------- 8 files changed, 49 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 2256c299..08f64579 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ I hope you will LoveIt ❤️! * **Gravatar** supported by [Gravatar](https://gravatar.com) * Local **Avatar** supported * Up to **76** social links supported -* Up to **24** share sites supported +* Up to **26** share sites supported * **Disqus** comment system supported by [Disqus](https://disqus.com) * **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk) * **Valine** comment system supported by [Valine](https://valine.js.org/) diff --git a/README.zh-cn.md b/README.zh-cn.md index f7656304..32be513a 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -81,7 +81,7 @@ * 支持 **[Gravatar](https://gravatar.com)** 头像 * 支持本地**头像** * 支持多达 **76** 种社交链接 -* 支持多达 **24** 种网站分享 +* 支持多达 **26** 种网站分享 * 支持 **[Disqus](https://disqus.com)** 评论系统 * 支持 **[Gitalk](https://github.com/gitalk/gitalk)** 评论系统 * 支持 **[Valine](https://valine.js.org/)** 评论系统 diff --git a/exampleSite/content/about/index.en.md b/exampleSite/content/about/index.en.md index 89a5cc03..c4a9d67b 100644 --- a/exampleSite/content/about/index.en.md +++ b/exampleSite/content/about/index.en.md @@ -54,7 +54,7 @@ math: * :(far fa-user fa-fw): **Gravatar** supported by [Gravatar](https://gravatar.com) * :(fas fa-user-circle fa-fw): Local **Avatar** supported * :(far fa-id-card fa-fw): Up to **76** social links supported -* :(fas fa-share-square fa-fw): Up to **24** share sites supported +* :(fas fa-share-square fa-fw): Up to **26** share sites supported * :(far fa-comment fa-fw): **Disqus** comment system supported by [Disqus](https://disqus.com) * :(far fa-comment-dots fa-fw): **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk) * :(far fa-comment-alt fa-fw): **Valine** comment system supported by [Valine](https://valine.js.org/) diff --git a/exampleSite/content/about/index.zh-cn.md b/exampleSite/content/about/index.zh-cn.md index bc299af5..cd935dac 100644 --- a/exampleSite/content/about/index.zh-cn.md +++ b/exampleSite/content/about/index.zh-cn.md @@ -54,7 +54,7 @@ math: * :(far fa-user fa-fw): 支持 **[Gravatar](https://gravatar.com)** 头像 * :(fas fa-user-circle fa-fw): 支持本地**头像** * :(far fa-id-card fa-fw): 支持多达 **76** 种社交链接 -* :(fas fa-share-square fa-fw): 支持多达 **24** 种网站分享 +* :(fas fa-share-square fa-fw): 支持多达 **26** 种网站分享 * :(far fa-comment fa-fw): 支持 **[Disqus](https://disqus.com)** 评论系统 * :(far fa-comment-dots fa-fw): 支持 **[Gitalk](https://github.com/gitalk/gitalk)** 评论系统 * :(far fa-comment-alt fa-fw): 支持 **[Valine](https://valine.js.org/)** 评论系统 diff --git a/exampleSite/content/posts/theme-documentation-basics/index.en.md b/exampleSite/content/posts/theme-documentation-basics/index.en.md index 1b312c8d..96fa2e33 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.en.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.en.md @@ -483,7 +483,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"] ORCID = "" Pleroma = "" Kaggle = "" - MediaWiki= "" + MediaWiki = "" Plume = "" HackTheBox = "" RootMe = "" @@ -563,6 +563,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"] enable = true X = true # {{< version 0.3.1 >}} Twitter = false # {{< version 0.3.1 deprecated >}} + Threads = true # {{< version 0.3.1 >}} Facebook = true Linkedin = false Whatsapp = false @@ -584,6 +585,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"] Evernote = false Skype = false Trello = false + Diaspora = true # {{< version 0.3.1 >}} Mix = false # {{< version 0.2.0 changed >}} Comment config [params.page.comment] diff --git a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md index 1aef74f7..f08f87c9 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md @@ -565,6 +565,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"] enable = true X = true # {{< version 0.3.1 >}} Twitter = false # {{< version 0.3.1 deprecated >}} + Threads = true # {{< version 0.3.1 >}} Facebook = true Linkedin = false Whatsapp = false @@ -586,6 +587,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"] Evernote = false Skype = false Trello = false + Diaspora = true # {{< version 0.3.1 >}} Mix = false # {{< version 0.2.0 changed >}} 评论系统设置 [params.page.comment] diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml index 96cca615..8b765294 100644 --- a/exampleSite/hugo.toml +++ b/exampleSite/hugo.toml @@ -356,7 +356,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"] ORCID = "" Pleroma = "" Kaggle = "" - MediaWiki= "" + MediaWiki = "" Plume = "" HackTheBox = "" RootMe= "" @@ -465,6 +465,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"] [params.page.share] enable = true X = true + Threads = true Facebook = true Linkedin = false Whatsapp = false @@ -486,6 +487,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"] Evernote = false Skype = false Trello = false + Diaspora = true Mix = false # Comment config # 评论系统设置 diff --git a/layouts/partials/plugin/share.html b/layouts/partials/plugin/share.html index e1d3d93b..4072231b 100644 --- a/layouts/partials/plugin/share.html +++ b/layouts/partials/plugin/share.html @@ -12,161 +12,175 @@ </a> {{- end -}} - {{- /* 002: Facebook */ -}} + {{- /* 002: Threads */ -}} + {{- if $share.Threads -}} + <a href="javascript:void(0);" title="{{ T `shareOn` }} Threads" data-sharer="threads" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> + {{- dict "Class" "fab fa-threads fa-fw" | partial "plugin/icon.html" -}} + </a> + {{- end -}} + + {{- /* 003: Facebook */ -}} {{- if $share.Facebook -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Facebook" data-sharer="facebook" data-url="{{ .Permalink }}"{{ with .Params.tags }} data-hashtag="{{ index . 0 }}"{{ end }}> {{- dict "Class" "fab fa-facebook-square fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 003: Linkedin */ -}} + {{- /* 004: Linkedin */ -}} {{- if $share.Linkedin -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Linkedin" data-sharer="linkedin" data-url="{{ .Permalink }}"> {{- dict "Class" "fab fa-linkedin fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 004: WhatsApp */ -}} + {{- /* 005: WhatsApp */ -}} {{- if $share.Whatsapp -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} WhatsApp" data-sharer="whatsapp" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-web> {{- dict "Class" "fab fa-whatsapp fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 005: Viber */ -}} + {{- /* 006: Viber */ -}} {{- if $share.Viber -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Viber" data-sharer="viber" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> {{- dict "Class" "fab fa-viber fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 006: Pinterest */ -}} + {{- /* 007: Pinterest */ -}} {{- if $share.Pinterest -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Pinterest" data-sharer="pinterest" data-url="{{ .Permalink }}"{{ with .Description }} data-description="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}> {{- dict "Class" "fab fa-pinterest fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 007: Tumblr */ -}} + {{- /* 008: Tumblr */ -}} {{- if $share.Tumblr -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Tumblr" data-sharer="tumblr" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.tags }} data-tags="{{ delimit . `,` }}"{{ end }}> {{- dict "Class" "fab fa-tumblr fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 008: Hacker News */ -}} + {{- /* 009: Hacker News */ -}} {{- if $share.Hackernews -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Hacker News" data-sharer="hackernews" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> {{- dict "Class" "fab fa-hacker-news fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 009: Reddit */ -}} + {{- /* 010: Reddit */ -}} {{- if $share.Reddit -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Reddit" data-sharer="reddit" data-url="{{ .Permalink }}"> {{- dict "Class" "fab fa-reddit fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 010: VK */ -}} + {{- /* 011: VK */ -}} {{- if $share.VK -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} VK" data-sharer="vk" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}> {{- dict "Class" "fab fa-vk fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 011: Buffer */ -}} + {{- /* 012: Buffer */ -}} {{- if $share.Buffer -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Buffer" data-sharer="buffer" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-picture="{{ . }}"{{ end }}> {{- dict "Class" "fab fa-buffer fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 012: Xing */ -}} + {{- /* 013: Xing */ -}} {{- if $share.Xing -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Xing" data-sharer="xing" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> {{- dict "Class" "fab fa-xing fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 013: Line */ -}} + {{- /* 014: Line */ -}} {{- if $share.Line -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Line" data-sharer="line" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> {{- dict "Simpleicons" "line" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 014: Instapaper */ -}} + {{- /* 015: Instapaper */ -}} {{- if $share.Instapaper -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Instapaper" data-sharer="instapaper" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}"> {{- dict "Simpleicons" "instapaper" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 015: Pocket */ -}} + {{- /* 016: Pocket */ -}} {{- if $share.Pocket -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Pocket" data-sharer="pocket" data-url="{{ .Permalink }}"> {{- dict "Class" "fab fa-get-pocket fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 016: Flipboard */ -}} + {{- /* 017: Flipboard */ -}} {{- if $share.Flipboard -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Flipboard" data-sharer="flipboard" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> {{- dict "Class" "fab fa-flipboard fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 017: 微博 */ -}} + {{- /* 018: Weibo */ -}} {{- if $share.Weibo -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} 微博" data-sharer="weibo" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}{{ with .Site.Params.Social.Weibo }} data-ralateuid="{{ . }}"{{ end }}> {{- dict "Class" "fab fa-weibo fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 018: Blogger */ -}} + {{- /* 019: Blogger */ -}} {{- if $share.Blogger -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Blogger" data-sharer="blogger" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}"> {{- dict "Class" "fab fa-blogger fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 019: 百度 */ -}} + {{- /* 020: Baidu */ -}} {{- if $share.Baidu -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> {{- dict "Simpleicons" "baidu" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 020: OK.RU */ -}} + {{- /* 021: OK.RU */ -}} {{- if $share.Odnoklassniki -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} OK.RU" data-sharer="okru" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> {{- dict "Class" "fab fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 021: Evernote */ -}} + {{- /* 022: Evernote */ -}} {{- if $share.Evernote -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Evernote" data-sharer="evernote" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> {{- dict "Class" "fab fa-evernote fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 022: Skype */ -}} + {{- /* 023: Skype */ -}} {{- if $share.Skype -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Skype" data-sharer="skype" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> {{- dict "Class" "fab fa-skype fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 023: Trello */ -}} + {{- /* 024: Trello */ -}} {{- if $share.Trello -}} <a href="javascript:void(0);" title="{{ T `shareOn` }} Trello" data-sharer="trello" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}"> {{- dict "Class" "fab fa-trello fa-fw" | partial "plugin/icon.html" -}} </a> {{- end -}} - {{- /* 024: Mix */ -}} + {{- /* 025: Diaspora */ -}} + {{- if $share.Diaspora -}} + <a href="javascript:void(0);" title="{{ T `shareOn` }} Diaspora" data-sharer="diaspora" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}"> + {{- dict "Class" "fab fa-diaspora fa-fw" | partial "plugin/icon.html" -}} + </a> + {{- end -}} + + {{- /* 026: Mix */ -}} {{- if $share.Mix -}} <a href="//mix.com/add?url={{ .Permalink }}&description={{ .Title }}" target="_blank" title="{{ T `shareOn` }} Mix"> {{- dict "Class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}}