Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 836 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 836 Bytes

HN comments

Get comments from Hacker News with javascript for your static (or not) site

Usage

Create an element with id="hnComments" in your markup. It should have a data-hn-id attribute whose value is the id of the post you made on hn, e.g.

https://news.ycombinator.com/item?id=15044479
                                     ^^^^^^^^
                                     THIS IS THE ID

The comments will be inserted after that element.

Example :

<h4 id="hnComments" style="margin-top:4em" data-hn-id="15044479">
    Comments from <a href="https://news.ycombinator.com/item?id=15044479">HN</a>
    <a href="https://news.ycombinator.com/item?id=15044479">Discuss</a>
</h4>
<script src="assets/js/hn.js></script>

MIT LICENSE. View the LICENSE file in this repository