Skip to content

Commit 619cd31

Browse files
committed
Optimize share buttons
1 parent b94588a commit 619cd31

File tree

2 files changed

+71
-61
lines changed

2 files changed

+71
-61
lines changed

_config.yml

+64
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,70 @@ relative_links:
1515
include: [".well-known"]
1616
timezone: Europe/Stockholm
1717
paginate: 20
18+
defaultmedia: https://github.com/EllieTheYeen.png
19+
20+
sharebuttons:
21+
- name: Tumblr
22+
base: https://www.tumblr.com/widgets/share/tool
23+
extra: posttype=link
24+
url: canonicalUrl
25+
title: title
26+
color: '#34465D'
27+
- name: Twitter
28+
base: https://twitter.com/intent/tweet
29+
url: url
30+
title: text
31+
color: '#08a0e9'
32+
- name: Reddit
33+
base: https://reddit.com/submit
34+
url: url
35+
title: title
36+
color: '#ff4500'
37+
- name: Facebook
38+
base: https://www.facebook.com/sharer.php
39+
url: u
40+
color: '#4267B2'
41+
- name: Pinterest
42+
base: http://pinterest.com/pin/create/link/
43+
url: url
44+
title: description
45+
media: media
46+
color: '#cc2127'
47+
- name: Telegram
48+
base: https://telegram.me/share/url
49+
url: url
50+
color: '#27a6e7'
51+
- name: YCombinator
52+
base: https://news.ycombinator.com/submitlink
53+
url: u
54+
title: t
55+
color: '#cc5200'
56+
- name: Instapaper
57+
base: https://www.instapaper.com/edit
58+
url: url
59+
color: '#828181'
60+
- name: Pinboard
61+
base: https://pinboard.in/add
62+
url: url
63+
color: '#1120ab'
64+
- name: Pocket
65+
base: https://getpocket.com/edit
66+
url: url
67+
color: '#e0264b'
68+
- name: GMail
69+
base: https://mail.google.com/mail/u/0/
70+
extra: 'fs=1&tf=cm'
71+
body: body
72+
color: '#ea4235'
73+
- name: Blogger
74+
base: https://www.blogger.com/blog_this.pyra
75+
body: n
76+
color: '#ff5722'
77+
- name: Email
78+
base: 'mailto:'
79+
body: body
80+
title: subject
81+
color: '#26BF74'
1882

1983
defaults:
2084
- scope:

_includes/share.html

+7-61
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,16 @@
11
<div id="share">
22
Share on
3-
<a class="sharelink" title="Share this on Tumblr"
4-
href="https://www.tumblr.com/widgets/share/tool?posttype=link&canonicalUrl={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}&title={{ page.title | uri_escape }}&caption=&content=&tags=">
5-
<span class="btn" style="background-color: #34465D;">Tumblr</span>
6-
</a>
7-
8-
<a class="sharelink" title="Share this on Twitter"
9-
href="https://twitter.com/intent/tweet?url={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}&text={{ page.title | uri_escape }}">
10-
<span class="btn" style="background-color: #08a0e9;">Twitter</span>
11-
</a>
12-
13-
<a href="javascript:void" title="Share this on Mastodon"><span class="btn" style="background-color: #6260fa;"
14-
onclick="mastodon_modal()">Mastodon</span></a>
15-
16-
<a class="sharelink" title="Share this on Reddit"
17-
href="https://reddit.com/submit?url={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}&title={{ page.title | uri_escape }}">
18-
<span class="btn" style="background-color: #ff4500;">Reddit</span></a>
19-
20-
<a class="sharelink" title="Share this on Facebook"
21-
href="https://www.facebook.com/sharer.php?u={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}">
22-
<span class="btn" style="background-color: #4267B2;">Facebook</span></a>
23-
24-
<a class="sharelink" title="Share this on Pinterest"
25-
href="http://pinterest.com/pin/create/link/?url={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}&media=https://github.com/EllieTheYeen.png&description={{ page.title | uri_escape }}">
26-
<span class="btn" style="background-color: #cc2127;">Pinterest</span>
27-
</a>
28-
29-
<a class="sharelink" title="Share this on Telegram"
30-
href="https://telegram.me/share/url?url={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}">
31-
<span class="btn" style="background-color: #27a6e7;">Telegram</span>
32-
</a>
333

34-
<a class="sharelink" title="Share this on Ycombinator"
35-
href="https://news.ycombinator.com/submitlink?u={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}&t={{ page.title | uri_escape }}">
36-
<span class="btn" style="background-color: #cc5200;">Ycombinator</span>
37-
</a>
38-
39-
<a class="sharelink" title="Share this on Instapaper"
40-
href="https://www.instapaper.com/edit?url={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}">
41-
<span class="btn" style="background-color: #828181;">Instapaper</span>
42-
</a>
43-
44-
<a class="sharelink" title="Share this on Pinboard"
45-
href="https://pinboard.in/add?url={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}">
46-
<span class="btn" style="background-color: #1120ab;">Pinboard</span>
47-
</a>
4+
<a href="javascript:void" title="Share this on Mastodon">
5+
<span class="btn" style="background-color: #6260fa;" onclick="mastodon_modal()">Mastodon</span></a>
486

49-
<a class="sharelink" title="Share this on Pocket"
50-
href="https://getpocket.com/edit?url={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}">
51-
<span class="btn" style="background-color: #e0264b;">Pocket</span>
7+
{% for butt in site.sharebuttons %}
8+
<a class="sharelink" title="Share this on {{ butt.name }}" target="_blank"
9+
href="{{ butt.base }}?{%- if butt.extra -%}{{ butt.extra }}{%- endif -%}{%- if butt.url -%}&{{ butt.url }}={{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}{%- endif -%}{%- if butt.title -%}&{{ butt.title }}={{ page.title | uri_escape }}{%- endif -%}{%- if butt.body -%}&{{ butt.body }}={{ page.title | uri_escape }}%0A{{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}%0A{%- endif -%}{%- if butt.media -%}&{{ butt.media }}={{ site.defaultmedia }}{%- endif -%}">
10+
<span class="btn" style="background-color: {{ butt.color }};">{{ butt.name }}</span>
5211
</a>
12+
{% endfor %}
5313

54-
<a class="sharelink" title="Share this on GMail"
55-
href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&body={{ page.title | uri_escape }}%0A{{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}%0A">
56-
<span class="btn" style="background-color: #ea4235;">GMail</span>
57-
</a>
58-
59-
<a class="sharelink" title="Share this on Blogger"
60-
href="https://www.blogger.com/blog_this.pyra?n={{ page.title | uri_escape }}%0A{{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}%0A">
61-
<span class="btn" style="background-color: #ff5722;">Blogger</span>
62-
</a>
63-
64-
<a class="sharelink" title="Share this through email"
65-
href="mailto:?subject={{ page.title | uri_escape }}&body={{ page.title | uri_escape }}%0A{{ 'https://ellietheyeen.github.io' | append: page.url | uri_escape }}%0A">
66-
<span class="btn" style="background-color: #26BF74;">Email</span>
67-
</a>
6814
</div>
6915
<dialog id="mastodon_modal">
7016
<button onclick="mastodon_modal(true)">Close</button><br />

0 commit comments

Comments
 (0)