View on GitHub


Embed Hacker News comment tree automatically


Embed Hacker News comment tree automatically on your website.

How it works

There is always better discussion on HN than in your Disqus comment box. Instead of a link to HN, you can embed it on your page.


  1. Value-add your readers from other sources.

  2. Boost site ranking and SEO. (GoogleBot executes JavaScript).

  3. Keep discussion on your page.

  4. Alternatively, checkout txtpen for highlights and inline comments.

This tool queries from so the response time is around ~10ms. It won’t slow your page down.

Basic Usage

  1. Embed the javascript file.

    a. Put these lines at the top of page before </head>

     <link rel="preload" href="" as="script">
     <link href="" rel="stylesheet">

    b. Put this after </body> tag

     <script src=""></script>
  2. Add HTML tag to embed comment tree.

<txtpen-hn-comment> </txtpen-hn-comment>
  1. That’s it. Enjoy :+1:

  2. Optional: if you want to specify the Story ID, add a meta tag similar to the one below. Otherwise it will query the url and link the corresponding HN comments automatically.

<meta property="hacker-news" content="{PUT_YOUR_STORY_ID_HERE}">


git clone
cd hn
npm install
npm run dev
# Production build:
# npm run build