Set social buttons and get share numbers.
Available social buttons are:
- Hatena Bookmark
- Google+
- Buffer (not in sharing.html)
- Delicious (currently count is not available)
- Tumblr (Only button w/o cound)
To use active mode with JavaScript, please install rcmdnk/jekyll-var-to-js, too.
Update 17/Dec/2015:
Twitter's API is no longer available. In octopress-share-number, currently count.jsoon is used instead of Twitter's API.
To enable count.jsoon, please register your URL from here, then counts will be available in a few days.
There are three methods:
- Official API for buttons.
- Copy source/_includes/post/sharing.html (extended sharing buttons file of Octopress) to your source/_includes/post/.
- Custom buttons, getting numbers actively by JavaScript.
- Copy source/_includes/post/sharing_custom.html. to your source/_includes/post/.
- Copy source/javascripts/share-custom.js to your soruce/javascripts/.
- Custom buttons, getting numbers statically by the plugin.
- Copy source/_includes/post/sharing_custom.html. to your source/_includes/post/.
- Copy source/facebook_shares.html. to your source/facebook_shares.html.
- Copy plugins/share-numbers.rb to your plugins.
Copy sass/plugins/_share-numbers.scss to you sass/plugins/.
Put share-custom.js in source/_includes/head.html, after jQuery (share-custom.js uses jQuery):
{% unless site.share_static %}<script src="{{root_url}}/javascripts/compressed/share-custom.js"></script>{% endunless %}
Put sharing_custom.html in such source/_layouts/post.html, like:
</p>
{% unless page.sharing == false %}
+{% unless site.share_official == false %}
{% include post/sharing.html %}
{% endunless %}
+{% if site.share_custom == true %}
+{% include post/sharing_custom.html %}
+{% endif %}
+{% endunless %}
<p class="meta">
And set your configuration in _config.yml:
# CPUs for parallel jobs
n_cores: 4
# Choose method
share_official: false
share_custom: true
share_static: true
share_check_all: false
# Select shares
hatebu_button: true
twitter_button: true
facebook_button: true
pocket_button: true
linkedin_button: false
pinterest_button: false
buffer_button: false
delicious_button: false
tumblr_button: false
# share_all: true # to enable all
# jekyll-var
jekyll_var:
include:
- hatebu_button
- twitter_button
- facebook_button
- pocket_button
- linkedin_button
- pinterest_button
- buffer_button
- delicious_button
- share_check_all
First, choose method:
- Official API for buttons.
- Set
share_official: true
. - Set
share_custom: false
.
- Set
- Custom buttons, getting numbers actively by JavaScript.
- Set
share_official: false
. - Set
share_custom: true
. - Set
share_static: false
.
- Set
- Custom buttons, getting numbers statically by the plugin.
- Set
share_official: false
. - Set
share_custom: true
. - Set
share_static: true
.
- Set
If share_check_all
is enabled,
the plugin gets numbers for all shares
and store to the memory.
But only buttons which are enabled are shown in sharing_custom.html.
(Useful if you want to use in other places.)
If you want to show all buttons, use share_all: true
.
n_cores
is used in the plugin, to decide how many threads should run.