Skip to content

Commit 48c233b

Browse files
authored
Merge pull request #196 from cass-community/bernhold-social-enhancements
Improve flexibility of social sharing buttons
2 parents a6019e7 + cc9a1ae commit 48c233b

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

_includes/event-sidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ <h3 ><small>{{ event_y }}</small><br>
4040
{% comment %}
4141
Including here rather than at the bottom of the main content
4242
{% endcomment %}
43-
{% if page.share %}{% include social-share.html %}{% endif %}
43+
{% if page.share %}{% include social-share.html compact=true class="btn--small" %}{% endif %}
4444

4545
</div>

_includes/social-share.html

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{% comment %}
2+
Parameters
3+
compact: Make buttons more compact by showing only logos, not names (OPTIONAL, default: false)
4+
class: Specify additional class options for the buttons (OPTIONAL)
5+
This option allows *additional* CSS classes to be added to the button specification.
6+
It is primarily intended to support size specifications (`btn--x-large`, `btn--large`, `btn--small`).
7+
8+
CHANGES FROM DEFAULT SOCIAL-SHARE.HTML
9+
* Changed order
10+
* Added Mastodon
11+
* Added email
12+
* Added optional "compact" parameter
13+
* Added optional "class" parameter
14+
{% endcomment %}
15+
{% comment %} Work around inconsistent treatment of booleans by `default` filter {% endcomment %}
16+
{% if include.compact == nil %}
17+
{% assign compact = false %}
18+
{% else %}
19+
{% assign compact = include.compact %}
20+
{% endif %}
21+
{% assign class = include.class | default: "" %}
22+
<section class="page__share">
23+
<h4 class="page__share-title">{{ site.data.ui-text[site.locale].share_on_label | default: "Share on" }}</h4>
24+
25+
<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ page.url | absolute_url }}" class="btn btn--linkedin {{ class }}" aria-label="Share on LinkedIn" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[site.locale].share_on_label | default: 'Share on' }} LinkedIn">
26+
<i class="fab fa-fw fa-linkedin" aria-hidden="true"></i>{% unless compact %}<span> LinkedIn</span>{% endunless %}
27+
</a>
28+
29+
<a href="https://mastodon.social/share?text={{ page.title | url_encode }}%20{{ page.url | absolute_url | url_encode }}" class="btn btn--mastodon {{ class }}" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[site.locale].share_on_label | default: 'Share on' }} Mastodon">
30+
<i class="fab fa-fw fa-mastodon" aria-hidden="true"></i>{% unless compact %}<span> Mastodon</span>{% endunless %}
31+
</a>
32+
33+
<a href="https://bsky.app/intent/compose?text={{ page.title | url_encode }}%20{{ page.url | absolute_url | url_encode }}" class="btn btn--bluesky {{ class }}" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[site.locale].share_on_label | default: 'Share on' }} Bluesky">
34+
<i class="fab fa-fw fa-bluesky" aria-hidden="true"></i>{% unless compact %}<span> Bluesky</span>{% endunless %}
35+
</a>
36+
37+
<a href="https://x.com/intent/tweet?{% if site.twitter.username %}via={{ site.twitter.username | url_encode }}&{% endif %}text={{ page.title | url_encode }}%20{{ page.url | absolute_url | url_encode }}" class="btn btn--x {{ class }}" aria-label="Share on X" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[site.locale].share_on_label | default: 'Share on' }} X">
38+
<i class="fab fa-fw fa-x-twitter" aria-hidden="true"></i>{% unless compact %}<span> X</span>{% endunless %}
39+
</a>
40+
41+
<a href="https://www.facebook.com/sharer/sharer.php?u={{ page.url | absolute_url | url_encode }}" class="btn btn--facebook {{ class }}" aria-label="Share on Facebook" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[site.locale].share_on_label | default: 'Share on' }} Facebook">
42+
<i class="fab fa-fw fa-facebook" aria-hidden="true"></i>{% unless compact %}<span> Facebook</span>{% endunless %}
43+
</a>
44+
45+
<a href="mailto:?subject=CASS event: {{ page.title }}&body={{ page.url | absolute_url | url_encode }}" class="btn btn--email btn--primary {{ class }}" aria-label="Share on Email" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[site.locale].share_on_label | default: 'Share on' }} Email">
46+
<i class="fas fa-fw fa-envelope" aria-hidden="true"></i>{% unless compact %}<span> Email</span>{% endunless %}
47+
</section>

0 commit comments

Comments
 (0)