YComments

Contact

Embedded Hacker News Discussions!

Automatically retrieve the highest ranked post on news.ycombinator.com. And output the comments to a div tag.

// 1. Add the javascript file to your header
<script src="https://cdn.rawgit.com/benwinding/ycomments/b7310c55/dist/ycomments.min.js" ></script>
// 2. Add the div tag where you want the comments to end up.
// Automatic lookup based on page URL.
<div comments="auto"></div>
// Manual lookup based on post id.
<div comments="16582136"></div>

Responsive

The comments will adjust to what ever container they're in.

Automatic

The script can either fetch a specific item, or dynamically query based on the URL

No Tracking!

The script talks directly to the open source Hacker News public api from the users browser.

FAQ

Some questions you might have...

Why did you make this?

I wanted to see if it was possible to dynamically show the related discussion on the site it was on... pretty meta

How does this work, in "manual mode"?

It queries the Hacker News api based on the id provided in the div tag.

How does this work, in "auto mode"?

It queries the Hacker News API directly using the current URL of the page it's on.