- Create a file
hn_like.html
with following contents undersource/_includes
directory
{% if site.hn_like_button %}
<!--
hn like button plugin for jekyll/octopress
Author: dryman (Felix Ren-Chyan Chern)
Inpired from http://hnlike.com/ written by sbashyal
(The MIT License)
Copyright © 2012-2013 Felix Ren-Chyan Chern
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the ‘Software’), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<script type="text/javascript">
(function(){
var hn_like = document.createElement('iframe');
hn_like.frameborder="no";
hn_like.scrolling="no";
hn_like.height="28px";
hn_like.width="115px";
hn_like.src = "http://hnlike.com/upvote.php?link="
+ encodeURIComponent(document.location)
+ "&title="
+ encodeURIComponent("{{ page.title }}");
hn_like.innerHTML="iframes not supported by your browser";
var twitter = document.getElementsByClassName("twitter-share-button")[0];
twitter.parentNode.insertBefore(
hn_like,
twitter
);
})();
</script>
<!-- end of hn like button -->
{% endif %}
-
Add one line
{% include hn_like.html %}
intosource/_includes/after_footer.html
-
Add following lines into
_config.yml
# hacker news like button
hn_like_button: true