Skip to content

Commit 30d4b05

Browse files
TimonVSashenden
authored andcommitted
Add social share buttons
1 parent 5daae57 commit 30d4b05

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

env.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"development": {
3+
"root_url": "http://localhost:3000"
4+
},
5+
"production": {
6+
"root_url": "https://dcos.io"
7+
}
8+
}

index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const writemetadata = require('metalsmith-writemetadata')
2424
const moment = require('moment')
2525
const tags = require('metalsmith-tags')
2626
const mlunr = require('metalsmith-lunr')
27+
const CONFIG = require('./env.json')[process.env.NODE_ENV] || require('./env.json')['production']
2728

2829
// --- general build settings --- //
2930
const docsVersions = ['1.7'];
@@ -179,7 +180,8 @@ Metalsmith(__dirname)
179180
}
180181
}))
181182
.use(define({
182-
moment
183+
moment,
184+
rootUrl: CONFIG.root_url
183185
}))
184186
.use(sass({
185187
outputStyle: 'expanded',

layouts/article.jade

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ block content
3636
article.post-content.blog-article!= contents
3737

3838
.blog__article-footer
39-
.blog__social-share
39+
a(href="http://twitter.com/share?text=#{encodeURIComponent(title)}&url=#{rootUrl}/#{path}", target="_blank").blog__social-share
4040
img(src='/assets/images/icons/twitter-icon.svg')
4141
p Tweet
4242

43-
.blog__social-share
43+
a(href="https://www.facebook.com/sharer/sharer.php?u=#{rootUrl}/#{path}", target="_blank").blog__social-share
4444
img(src='/assets/images/icons/facebook-icon.svg')
4545
p Share
4646

47-
.blog__social-share
47+
a(href="https://plus.google.com/share?url=#{rootUrl}/#{path}", target="_blank").blog__social-share
4848
img(src='/assets/images/icons/googleplus-icon.svg')
4949
p Share
5050

51-
.blog__social-share
51+
a(href="http://news.ycombinator.com/submit", target="_blank").blog__social-share
5252
img(src='/assets/images/icons/hackernews-icon.svg')
5353
p Vote
5454

0 commit comments

Comments
 (0)