1
0
Fork 0
mirror of https://github.com/dillonzq/LoveIt.git synced 2025-03-13 11:18:15 +01:00

feat(social): support social link X ()

This commit is contained in:
Dillon 2025-03-06 00:58:53 +08:00 committed by GitHub
parent 18cff92075
commit f07a30142d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 54 additions and 31 deletions
assets/data
exampleSite
content/posts/theme-documentation-basics
hugo.toml
hugo.toml
i18n
layouts/partials

View file

@ -14,13 +14,16 @@ linkedin:
Icon:
Class: fab fa-linkedin fa-fw
# 003: Twitter
twitter:
# 003: X
x:
Weight: 3
Prefix: https://twitter.com/
Title: Twitter
Prefix: https://x.com/
Title: X
Icon:
Class: fab fa-twitter fa-fw
Class: fab fa-x-twitter fa-fw
twitter:
Alias: x
# 004: Instagram
instagram:

View file

@ -416,7 +416,8 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
[params.social]
GitHub = "xxxx"
Linkedin = ""
Twitter = "xxxx"
X = "xxxx" # {{< version 0.3.1 >}}
Twitter = "" # {{< version 0.3.1 deprecated >}}
Instagram = "xxxx"
Facebook = "xxxx"
Telegram = "xxxx"
@ -485,11 +486,11 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
MediaWiki= ""
Plume = ""
HackTheBox = ""
RootMe= ""
Malt = ""
TikTok = ""
TryHackMe = ""
Codeberg = ""
RootMe = ""
Malt = "" # {{< version 0.3.0 >}}
TikTok = "" # {{< version 0.3.0 >}}
TryHackMe = "" # {{< version 0.3.0 >}}
Codeberg = "" # {{< version 0.3.0 >}}
Phone = ""
Email = "xxxx@xxxx.com"
RSS = true # {{< version 0.2.0 >}}
@ -560,7 +561,8 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
# {{< version 0.2.0 changed >}} social share links in post page
[params.page.share]
enable = true
Twitter = true
X = true # {{< version 0.3.1 >}}
Twitter = false # {{< version 0.3.1 deprecated >}}
Facebook = true
Linkedin = false
Whatsapp = false

View file

@ -418,7 +418,8 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
[params.social]
GitHub = "xxxx"
Linkedin = ""
Twitter = "xxxx"
X = "xxxx" # {{< version 0.3.1 >}}
Twitter = "" # {{< version 0.3.1 deprecated >}}
Instagram = "xxxx"
Facebook = "xxxx"
Telegram = "xxxx"
@ -484,14 +485,14 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
ORCID = ""
Pleroma = ""
Kaggle = ""
MediaWiki= ""
MediaWiki = ""
Plume = ""
HackTheBox = ""
RootMe= ""
Malt = ""
TikTok = ""
TryHackMe = ""
Codeberg = ""
RootMe = ""
Malt = "" # {{< version 0.3.0 >}}
TikTok = "" # {{< version 0.3.0 >}}
TryHackMe = "" # {{< version 0.3.0 >}}
Codeberg = "" # {{< version 0.3.0 >}}
Phone = ""
Email = "xxxx@xxxx.com"
RSS = true # {{< version 0.2.0 >}}
@ -562,7 +563,8 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
# {{< version 0.2.0 changed >}} 文章页面的分享信息设置
[params.page.share]
enable = true
Twitter = true
X = true # {{< version 0.3.1 >}}
Twitter = false # {{< version 0.3.1 deprecated >}}
Facebook = true
Linkedin = false
Whatsapp = false

View file

@ -290,7 +290,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
[params.social]
GitHub = ""
Linkedin = ""
Twitter = ""
X = ""
Instagram = ""
Facebook = ""
Telegram = ""
@ -464,7 +464,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
# 文章页面的分享信息设置
[params.page.share]
enable = true
Twitter = true
X = true
Facebook = true
Linkedin = false
Whatsapp = false
@ -873,7 +873,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
disclaimer = ""
[languages.en.params.social]
GitHub = "xxxx"
Twitter = "xxxx"
X = "xxxx"
Instagram = "xxxx"
Facebook = "xxxx"
Telegram = "xxxx"

View file

@ -209,7 +209,7 @@
[params.social]
GitHub = ""
Linkedin = ""
Twitter = ""
X = ""
Instagram = ""
Facebook = ""
Telegram = ""
@ -275,10 +275,10 @@
ORCID = ""
Pleroma = ""
Kaggle = ""
MediaWiki= ""
MediaWiki = ""
Plume = ""
HackTheBox = ""
RootMe= ""
RootMe = ""
Malt = ""
TikTok = ""
TryHackMe = ""
@ -384,7 +384,7 @@
# 文章页面的分享信息设置
[params.page.share]
enable = true
Twitter = true
X = true
Facebook = true
Linkedin = false
Whatsapp = false

View file

@ -195,4 +195,7 @@ other = "CHANGED"
[deleted]
other = "DELETED"
[deprecated]
other = "DEPRECATED"
# === shortcodes/version.html ===

View file

@ -200,4 +200,7 @@ other = "更改"
[deleted]
other = "删除"
[deprecated]
other = "弃用"
# === shortcodes/version.html ===

View file

@ -197,4 +197,7 @@ other = "更改"
[deleted]
other = "刪除"
[deprecated]
other = "棄用"
# === shortcodes/version.html ===

View file

@ -45,6 +45,9 @@
{{- $socialArr := slice -}}
{{- range $key, $value := .Site.Params.social -}}
{{- $social := $key | lower | index $socialMap | default dict -}}
{{- with $social.Alias -}}
{{- $social = index $socialMap . | default dict -}}
{{- end -}}
{{- if $value -}}
{{- if reflect.IsMap $value -}}
{{- with $value.weight -}}

View file

@ -1,10 +1,14 @@
{{- $share := (.Scratch.Get "params").share | default dict -}}
{{- if $share.enable -}}
{{- /* 001: Twitter */ -}}
{{- if $share.Twitter -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Twitter" data-sharer="twitter" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.tags }} data-hashtags="{{ delimit . `,` }}"{{ end }}>
{{- dict "Class" "fab fa-twitter fa-fw" | partial "plugin/icon.html" -}}
{{- /* 001: X */ -}}
{{- if $share.X | default $share.Twitter -}}
{{- $socialX := .Site.Params.Social.X | default .Site.Params.Social.Twitter -}}
{{- if reflect.IsMap $socialX -}}
{{- $socialX = $socialX.id -}}
{{- end -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} X" data-sharer="x" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with $socialX }} data-via="{{ . }}"{{ end }}{{ with .Params.tags }} data-hashtags="{{ delimit . `,` }}"{{ end }}>
{{- dict "Class" "fab fa-x-twitter fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}