Skip to content

Commit

Permalink
sharethis code
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianhall committed Jun 8, 2024
1 parent 905e506 commit d3e8a51
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 6 deletions.
2 changes: 2 additions & 0 deletions _includes/head/custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
<meta name="theme-color" content="#ffffff">

<link rel="stylesheet" href="{{ '/assets/css/site.css' | relative_url }}">

<script type="text/javascript" src="https://platform-api.sharethis.com/js/sharethis.js#property=6664dc89bc91a90019554985&product=inline-share-buttons&source=platform" async="async"></script>
<!-- end custom head snippets -->
9 changes: 9 additions & 0 deletions _includes/social-share-old.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<section class="page__share">
{% if site.data.ui-text[site.locale].share_on_label %}
<h4 class="page__share-title">{{ site.data.ui-text[site.locale].share_on_label | default: "Share on" }}</h4>
{% endif %}

{% include social-share/twitter.html %}
{% include social-share/facebook.html %}
{% include social-share/linkedin.html %}
</section>
7 changes: 1 addition & 6 deletions _includes/social-share.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@
{% if site.data.ui-text[site.locale].share_on_label %}
<h4 class="page__share-title">{{ site.data.ui-text[site.locale].share_on_label | default: "Share on" }}</h4>
{% endif %}

<a href="https://twitter.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--twitter" 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' }} Twitter"><i class="fab fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span></a>

<a href="https://www.facebook.com/sharer/sharer.php?u={{ page.url | absolute_url | url_encode }}" class="btn btn--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"><i class="fab fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span></a>

<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ page.url | absolute_url }}" class="btn btn--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"><i class="fab fa-fw fa-linkedin" aria-hidden="true"></i><span> LinkedIn</span></a>
<div class="sharethis-inline-share-buttons"></div>
</section>
8 changes: 8 additions & 0 deletions _includes/social-share/facebook.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% assign onclick = "window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" %}
{% assign sharetitle = site.data.ui-text[site.locale].share_on_label | default: 'Share on' | append: ' Facebook' %}
{% assign posttitle = page.title | urlencode %}
{% assign posturl = page.url | absolute_url | urlencode %}

<a href="https://www.facebook.com/sharer/sharer.php?t={{ posttitle }}&u={{ posturl }}" class="btn btn--facebook" onclick="{{ onclick }}" title="{{ sharetitle }}">
<i class="fab fa-fw fa-facebook" aria-hidden="true"></i>
</a>
10 changes: 10 additions & 0 deletions _includes/social-share/linkedin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% assign onclick = "window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" %}
{% assign sharetitle = site.data.ui-text[site.locale].share_on_label | default: 'Share on' | append: ' LinkedIn' %}
{% assign posttitle = page.title | urlencode %}
{% assign posturl = page.url | absolute_url | urlencode %}

<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ page.url | absolute_url }}" class="btn btn--linkedin" onclick="{{ onclick }}" title="{{ sharetitle }}">
<i class="fab fa-fw fa-linkedin" aria-hidden="true"></i>
</a>


7 changes: 7 additions & 0 deletions _includes/social-share/twitter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% assign onclick = "window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" %}
{% assign sharetitle = site.data.ui-text[site.locale].share_on_label | default: 'Share on' | append: ' X' %}
{% assign posttitle = page.title | urlencode %}
{% assign posturl = page.url | absolute_url | urlencode %}
<a href="https://x.com/intent/post?text={{ posttitle }}%20{{ posturl }}" class="btn btn--x-twitter" onclick="{{ onclick }}" title="{{ sharetitle }}">
<i class="fab fa-fw fa-x-twitter" aria-hidden="true"></i>
</a>

0 comments on commit d3e8a51

Please sign in to comment.