mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 04:14:41 +00:00
feat(page): enable page sharing buttons to be customized
To customise sharing buttons, override `themes/academic/data/page_sharer.toml` by copying the file to `data/page_sharer.toml` at the root of a site and editing the copy. Close #1108 Close #1131
This commit is contained in:
1 parent
4fed5675e9
commit
0c36cdca45
2 files changed
+69
-34
No files matched your search
@@ -0,0 +1,55 @@
|
||||
[[buttons]]
|
||||
id = "twitter"
|
||||
url = "https://twitter.com/intent/tweet?url={url}&text={title}"
|
||||
title = "Twitter"
|
||||
icon_pack = "fab"
|
||||
icon = "twitter"
|
||||
enable = true
|
||||
|
||||
[[buttons]]
|
||||
id = "facebook"
|
||||
url = "https://www.facebook.com/sharer.php?u={url}&t={title}"
|
||||
title = "Facebook"
|
||||
icon_pack = "fab"
|
||||
icon = "facebook-f"
|
||||
enable = true
|
||||
|
||||
[[buttons]]
|
||||
id = "email"
|
||||
url = "mailto:?subject={title}&body={url}"
|
||||
title = "Email"
|
||||
icon_pack = "fas"
|
||||
icon = "envelope"
|
||||
enable = true
|
||||
|
||||
[[buttons]]
|
||||
id = "linkedin"
|
||||
url = "https://www.linkedin.com/shareArticle?url={url}&title={title}"
|
||||
title = "LinkedIn"
|
||||
icon_pack = "fab"
|
||||
icon = "linkedin-in"
|
||||
enable = true
|
||||
|
||||
[[buttons]]
|
||||
id = "whatsapp"
|
||||
url = "https://web.whatsapp.com/send?text={title}%20{url}"
|
||||
title = "WhatsApp"
|
||||
icon_pack = "fab"
|
||||
icon = "whatsapp"
|
||||
enable = true
|
||||
|
||||
[[buttons]]
|
||||
id = "weibo"
|
||||
url = "https://service.weibo.com/share/share.php?url={url}&title={title}"
|
||||
title = "Weibo"
|
||||
icon_pack = "fab"
|
||||
icon = "weibo"
|
||||
enable = true
|
||||
|
||||
[[buttons]]
|
||||
id = "reddit"
|
||||
url = "https://reddit.com/submit?url={url}&title={title}"
|
||||
title = "Reddit"
|
||||
icon_pack = "fab"
|
||||
icon = "reddit-alien"
|
||||
enable = false
|
||||
+14
-34
@@ -1,40 +1,20 @@
|
||||
{{ if and site.Params.sharing (ne .Params.share false) }}
|
||||
<div class="share-box" aria-hidden="true">
|
||||
<ul class="share">
|
||||
<li>
|
||||
<a class="twitter"
|
||||
href="https://twitter.com/intent/tweet?text={{ .Title | html }}&url={{ .Permalink | html }}"
|
||||
target="_blank" rel="noopener">
|
||||
<i class="fab fa-twitter"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="facebook"
|
||||
href="https://www.facebook.com/sharer.php?u={{ .Permalink | html }}"
|
||||
target="_blank" rel="noopener">
|
||||
<i class="fab fa-facebook-f"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="linkedin"
|
||||
href="https://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink | html }}&title={{ .Title | html }}"
|
||||
target="_blank" rel="noopener">
|
||||
<i class="fab fa-linkedin-in"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="weibo"
|
||||
href="http://service.weibo.com/share/share.php?url={{ .Permalink | html }}&title={{ .Title | html }}"
|
||||
target="_blank" rel="noopener">
|
||||
<i class="fab fa-weibo"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="email"
|
||||
href="mailto:?subject={{ .Title | html }}&body={{ .Permalink | html }}">
|
||||
<i class="fas fa-envelope"></i>
|
||||
</a>
|
||||
</li>
|
||||
{{ range where site.Data.page_sharer.buttons "enable" true }}
|
||||
{{ $pack := or .icon_pack "fas" }}
|
||||
{{ $pack_prefix := $pack }}
|
||||
{{ if in (slice "fab" "fas" "far" "fal") $pack }}
|
||||
{{ $pack_prefix = "fa" }}
|
||||
{{ end }}
|
||||
{{ $link := replace .url "{url}" ($.Permalink | htmlEscape) }}
|
||||
{{ $link = replace $link "{title}" ($.Title | htmlEscape) }}
|
||||
<li>
|
||||
<a href="{{$link|safeURL}}" target="_blank" rel="noopener" class="share-btn-{{.id}}">
|
||||
<i class="{{$pack}} {{$pack_prefix}}-{{.icon}}"></i>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
Reference in new issue
Block a user