Skip to content

jfoucher/hn-comments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

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