feat(): add support for Twitter and Facebook share buttons

This commit is contained in:
kendo5731 2016-02-04 22:59:25 +01:00
parent b8e812859e
commit f5b5ae55d9
4 changed files with 26 additions and 1 deletions

View File

@ -6,7 +6,6 @@ A theme for [Hugo](https://gohugo.io/), inspired by Atom editor.
This repo is a work in progress, there is still work to do, contributions are welcome !
- Support Twitter and Facebook share buttons
- Support pagination in list layout
- Support "dynamic" titles and descriptions
- Uglify CSS and Javascript

View File

@ -1,6 +1,7 @@
{{ partial "top.html" . }}
<h1>{{ .Title }}</h1>
<h4>Publié le {{ dateFormat "01-02-2006 15:04:05" .Date }}</h4>
{{ partial "share.html" . }}
<article>
{{ .Content }}
</article>

View File

@ -0,0 +1,21 @@
<!-- Share on Twitter -->
<a href="https://twitter.com/share" class="twitter-share-button" data-via="kendo5731"></a>
<script>!function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');</script>
<div class="fb-share-button" data-href="{{ .Permalink }}" data-layout="button"></div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/fr_FR/sdk.js#xfbml=1&version=v2.5";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

View File

@ -135,3 +135,7 @@ a {
height: 100%;
}
}
.fb-share-button iframe {
margin-top: -5px;
}