Skip to content
Embeddable Hacker News button + vote counter for your site
Go JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
hnbutton gofmt wins Sep 1, 2014
static update minified scripts Mar 19, 2013
.gitignore basic app to query hn api Apr 3, 2012 use script[async+defer] in readme Sep 1, 2014

Embeddable Hacker News vote / counter button

HN Button

Async, embeddable submit + vote counter button for Hacker News.

  • If the story has not been posted to HN, "Submit" button is shown, otherwise latest point count is displayed.
  • Auto-detects Google Analytics and registers clicks events (see reports under Traffic Sources > Social > Social Plugins).

Embedding the button

Step 1, place the HN link where you want the button appear on the page:

<!-- Auto-detect URL of current page and title if necessary -->
<a href="" class="hn-share-button">Vote on HN</a>

<!-- Override the URL and Title for the button -->
<a href="" class="hn-share-button" data-title="Some Title" data-url="">Vote on HN</a>

Step 2, include the (async) javascript file:

<script src="//" async defer></script>

Note: you can safely embed multiple buttons on the same page.


  • Kudos to @sbashyal and @stbullard for the button styling (
  • Kudos to Algolia for an awesome HN API
  • (MIT License) - Copyright (c) 2012 Ilya Grigorik
You can’t perform that action at this time.