Added option to choose social media icons in posts

This commit is contained in:
Pedro Moreno 2023-02-15 10:56:28 +01:00
parent a6a9d11506
commit eadb39e377
2 changed files with 41 additions and 5 deletions

View file

@ -31,7 +31,8 @@ form:
fields:
content_title:
type: spacer
type: section
underline: true
title: FUTURE.ADMIN.BLOG.BLOG_CONTENT_TITLE
header.content.items:
@ -104,3 +105,27 @@ form:
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
shareicons_title:
type: section
underline: true
title: FUTURE.ADMIN.BLOG.BLOG_CONTENT_SHAREICONS_TITLE
header.shareicons:
type: checkboxes
style: vertical
label: FUTURE.ADMIN.BLOG.BLOG_CONTENT_SHAREICONS
help: FUTURE.ADMIN.BLOG.BLOG_CONTENT_SHAREICONS_HELP
default:
facebook: true
twitter: true
whatsapp: true
telegram: true
options:
facebook: Facebook
twitter: Twitter
whatsapp: Whatsapp
telegram: Telegram
use: keys

View file

@ -92,14 +92,25 @@
{% endif %}
</ul>
{% if page.taxonomy.tag %}
<ul class="stats">
{% if page.taxonomy.tag %}
{% for tag in page.taxonomy.tag %}
<li><a href="{{ base_url }}/tag{{ config.system.param_sep }}{{ tag }}" itemprop="keywords">{{ tag }}</a></li>
{% endfor %}
{% endif %}
<li><a href="https://twitter.com/share" data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon brands fa-twitter"></a></li>
<li><a href="http://www.facebook.com/sharer.php?u={{ page.url(true) }}" class="icon brands fa-facebook"></a></li>
</ul>
{% endif %}
<ul class="share">
{% set share = [
{ 'name': 'facebook', 'icon': 'fa-facebook', 'enabled': header_var('shareicons.facebook')|defined(true), 'url': 'https://www.facebook.com/sharer/sharer.php?', 'params': {'u': page.url(true)} },
{ 'name': 'twitter', 'icon': 'fa-twitter', 'enabled': header_var('shareicons.twitter')|defined(true), 'url': 'https://twitter.com/intent/tweet?', 'params': {'text': page.title, 'url': page.url(true)} },
{ 'name': 'whatsapp', 'icon': 'fa-whatsapp', 'enabled': header_var('shareicons.whatsapp')|defined(true), 'url': 'https://wa.me/?', 'params': {'text': page.title ~ '. ' ~ page.url(true)}, 'action': 'share/whatsapp/share' },
{ 'name': 'telegram', 'icon': 'fa-telegram', 'enabled': header_var('shareicons.telegram')|defined(true), 'url': 'https://t.me/share/url?', 'params': {'url': page.url(true), 'text': page.title} },
] %}
{% for item in share %}
{% if item.enabled|defined(true) %}
<li><a class="icon brands {{ item.icon }}" target="_blank" href="{{- item.url -}}{{- item.params|url_encode-}}" {% if item.action is defined %}data-action="{{ item.action }}"{% endif %} aria-label="{{ item.name|capitalize }}" title="{{ item.name|capitalize }}"></a></li>
{% endif %}
{% endfor %}
</ul>
</footer>
</article>