🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/igrigorik/hackernews-button

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/igrigorik/hackernews-button

v0.0.0-20140901022424-e41ee3e3741e
Source
Go
Version published
Created
Source

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="http://news.ycombinator.com/submit" class="hn-share-button">Vote on HN</a>

<!-- Override the URL and Title for the button -->
<a href="http://news.ycombinator.com/submit" class="hn-share-button" data-title="Some Title" data-url="http://www.igvita.com/">Vote on HN</a>

Step 2, include the (async) javascript file:

<script src="//hnbutton.appspot.com/static/hn.min.js" async defer></script>

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

Misc

  • Kudos to @sbashyal and @stbullard for the button styling (hnlike.com)
  • Kudos to Algolia for an awesome HN API
  • (MIT License) - Copyright (c) 2012 Ilya Grigorik

FAQs

Package last updated on 01 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts