Show HN: Embed HN comments in your website
comments.network
comments.network
Minor gripe: not sure if it's a good idea that the network be an attribute name instead of an attribute value; to this:
<comment-box hackernews="11850599" limit="1" class="border"></comment-box>
I would prefer: <comment-box network="hackernews" items="11850599" limit="1" class="border"></comment-box>
If you have a different attribute name per network, the DTD changes every time you add a network. Not that anyone cares, but still.- - -
Edit: a previous version of this comment asked why the tag was not self-closing; in fact, custom elements in HTML5 should indeed have a closing tag; see
http://stackoverflow.com/questions/23961178/do-custom-elemen...
...if the element is one of the void elements,
or if the element is a foreign element, then
there may be a single U+002F SOLIDUS
character (/). This character has no effect
on void elements, but on foreign elements
it marks the start tag as self-closing.
The list of element types [2] is fairly short, so I think if you attempted to self-close a custom tag, behavior might depend on how the parser's error recovery treats custom elements.[1] http://w3c.github.io/html/syntax.html#start-tags
[2] http://w3c.github.io/html/syntax.html#writing-html-documents...
(Why would HTML5 have both self-closing and non-self closing tags though?? It's just a syntax shortcut, they should either take it or leave it, but create a special class of "empty tags" seems crazy to me).
It's obviously not very important... I can't seem to be able to put into words why it bothers me so much! ;-)
<comment-box network="hackernews reddit" items="11850599 11850500 11859454"></comment-box>
For the Edit: I searched this thorough, custom elements cannot be self-closing. And the closest thing that I found indicates that, even if they could be self-closing (void elements), then they cannot have anything inside (which is also not what I wanted).See example:
Sure, but attribute (or tag) names refer the the structure of the document whereas values refer to each special case; structurally (essentially) those two are the same:
<comment-box hackernews="1">
<comment-box reddit="4">
but you can't tell because they have different attributes.Okay, so in order to write (current solution):
<comment-box hackernews="11850599" reddit="11850500 11859454"></comment-box>
you could do: <comment-box network="hackernews" items="11850599"></comment-box>
<comment-box network="reddit" items="11850500 11859454"></comment-box>
which would work just the same, you just have to group consecutive comment-box into one; or you could even do this: <comment-box sources="hackernews: 11850599; reddit: 11850500 11859454"></comment-box>
(inline css style). <comment-box>
<source name="hackernews" items="12"/>
<source name="reddit" items="24 27"/>
</comment-box>
which would be very readable; but since we don't have self-closing tags and we need to use hyphens in tag names, it's probably defensible to try to limit the number of tags and put as much information as possible inside attributes...I think that's the same as with the modern <picture> and <video>. I recently tried something similar but in "traditional" html structure, but also found it a bit too verbose for my taste:
https://medium.com/@fpresencia/leveraging-modern-apis-a13fa6...
One of the reasons that HN comment threads are still mostly worthwhile when other sites and comment services are swamp fires is the community that has been built here.
That people have to come here to read and reply helps us form that community and our social norms.
Sometimes it's ok to remain a small club.
Taking the HN comment community out of the context of the site makes it no different than any other drive-by commenting platform.
This thought process: "HN Comments are great. I want comments on my site. Other comment systems are terrible. I'll put HN comments on my site". Misses the point of why HN comments are great and why these comments-as-a-platform services have all resulted in the same level of awful, despite repeated and varying attempts to solve the problem.
Put a link to HN comments in your footer, bring them here, let the community and the mods help shape the discussion. Don't take the HN conversation out of context and splat it across the web.
If you want federated comments, use one of the existing, awful, toxic commenting systems that inevitably result from that sort of usage.
Definitely harming the HN community is something that has been mentioned several times which I didn't consider because of what I mentioned above, so I will take that into account when I publish the final version. I don't want to change/harm the community at all, just so other people can read the awesome comments that happen here.
Happen here. In context. In the community.
And that could be a bad thing, no?
Well, it appears that other members of this community have different ideas about what this community "should be". And that's okay too.
I love the embedding of the comments. I love the ability to click to come to Hacker News and read the whole discussion. I don't love that particular feature though and wish it would be removed.
It's my understanding that keeping a discussion board like this one high quality is a very demanding and delicate task relying on great algorithms and lots of moderator effort.
I could easily envision that feature creating an overload.
This is my current low-tech solution on https://unop.uk that works on any page (or any site for that matter):
<a href="javascript:window.location=%22https://news.ycombinator.com/submitlink?u=%22+encodeURIComponent(document.location)+%22&t=%22+encodeURIComponent(document.title)">Submit / Comment on Hacker News</a>I would ask for Diaspora support, but after seeing that the comments will go through comments.network's infrastructure, I guess I'd rather not add that dependency.
Nice idea though, if you are cool with limiting comments to 2 weeks. I know some people do like that.
Also, would it be nice if Comments network integrated comments on their own when the thread is closed? So you can just comment on the site itself (once the network comments are closed it'd basically be an alternative to Disqus).
https://github.com/skx/e-comments/
It could do with some more love, to add nested comments, but otherwise it might be of interest.
- What are the features that you think are most exciting?
- Where would you use it? What kind of projects? I have some ideas of use-cases, but I'd love to hear yours.
<comment-box hackernews="11850599" filter="id:3243534" class="border"></comment-box>
However arguably this is useful because you can show N comments and the UI is made around that.You could also just hide everything else through CSS though:
https://jsfiddle.net/franciscop/fygps59v/2/
comment-box .comment,
comment-box .add {
display: none;
}
comment-box #id-12898146 {
display: block;
} <li class="comment" id="id-6547567" class="ind-1">...</li>
See updated answer and jsfiddle aboveHow does the initial submission to the sites work? Am I missing something or is this currently a manual process? It would be cool if it submitted on the first comment.
N.B. If you auto add all your blog posts to HN you will get silently blocked from submitting (although it will still appear to work from your point of view). You will then need to, firstly notice this, then email the mods to get unblocked.
I've hit this myself, so now I just include a simple link to:
javascript:window.location=%22https://news.ycombinator.com/submitlink?u=%22+encodeURIComponent(document.location)+%22&t=%22+encodeURIComponent(document.title)
You can see this at the bottom of all my posts on https://unop.uk and I've seen others do something similar.I kind of enjoyed the current userbase.
Not sure I'd like anything that pushes HN far and wide.
I wouldn't expect someone adding comments to a recipes blog, so they could add the appropriate source for the comments. Someone suggested Designer News, so I'll make the integration after the Product Hunt one.
An important reason to embed is for visual authenticity. A Tweet is embedded with the styling that goes with it because it's recognizable. Similarly, I can see an HN comment with the styling and instantly know it's from HN.
Besides visual authenticity, another reason to embed is for functionality. You can interact with an embedded tweet. For an HN comment, this assumes the reader to have an HN account, which is not as likely as a user having a twitter account, but considering the audience this might be wrong. This is not the problem, though.. The problem is that an HN comment is not a Tweet. It is not a sound-bite and voting on a comment that was taken out of context (which can be a long thread) is simply stupid, or something only a stupid person would do.
The optimist would say: "someone with a Hacker News account isn't stupid enough to do that; they won't use the embedded comment for that". This makes embedding for functionality useless.
The pessimist would say: only stupid people would do that and there are really stupid people who actually would do that, so why include a functionality that only stupid people would use? This also makes embedding for functionality useless.
So I guess we're left with embedding for visual authenticity only. Or taking a screen shot of the element.
Also something has to be said about the advantages of thin clients/strong back-ends, which means standardizing the response from https://comments.network/ of the different networks.
Well, then disregard what I said. What I wrote was the opinion from an end-user/page-reader perspective, not from the person who'll handle tweak the styling.
>I am not sure if this is a problem from me not being native (I'm Spanish)
I wouldn't be able to tell, not being native myself (I'm Algerian).
>What twitter does is keeping the control+developing their own code, an API/library that HN doesn't have available. And of course I'm now going down the road of asking for people's username/password of the different networks.
Pardon me, but have you looked at this https://github.com/HackerNews/API http://blog.ycombinator.com/hacker-news-api ? I'm sure you are aware Reddit has an API. Again, I'm sorry for failing to see what's the very particular problem to be solved, not being a developer and all.
- comments.network seems to use internal api[1]
- embedd.io directly request HN and Reddit
For the sake of it I will point out that the alternative, is actually two different third-parties dependencies, http://embedd.io/ snippet and https://hn.algolia.com/ service (;
I just saw that network.comments use internal api too for Reddit while it have a clean json API. I think it could be nicer for network.comments to be more transparent and to not depend on third party like network.comments internal api. In order to prevent servers maintenance and to give more privacy.
Imagine tomorrow, network.comments seduce every hackers on the world and have more than 100k blog are requesting network.comments/api server. You'll ask guys to install their own instance which is not your first goal to avoid installing stuff.
But you probably shouldn't boast about the size "as simple as including a 5k Javascript file" when you have a dependency/require jQuery for your project to work on the client side (which is also not disclosed as it's only in an example, which could mean it's only for that example but checking the source it's an actual dependency)...
I'm gonna be overhauling it over the next few weeks to support nested comments, and can almost certainly drop jQuery at that time too.
This seems to work very well combined with static site generators like Jekyll and Hugo, because you don't need any kind of server-logic and database.
The only other option I knew was Disqus, which in my opinion is a total train wreck on mobile (Messages not loading, clunky interface, awful branding).
I think there is a large market for an open-source library that you can just drop in that functions exactly like this... particularly if you can manage to get it to run entirely client-side.
https://chrome.google.com/webstore/detail/hacker-news-sideba...
(it sends all visited urls to hn.algolia.com though, to find the discussion - beware)
Also, to answer your question, a quick googling turned up https://www.hnwatcher.com -- dunno if it's any good though.
I've thought of setting up an alert for "opportunities to post a shameless plug" but decided against it (mostly because it seems against the spirit of HN.)
No need (for me). Recipe to roll your own comments for your DIY blog:
- write your own templates, content and engine
- crack out your python/alt-language and download the HN News API https://github.com/HackerNews/API for favs/stories posted
- find your firebase json repository https://hacker-news.firebaseio.com/v0/user/bootload.json?pri...
- download json posts by id. For example ^this post^ cf: https://hacker-news.firebaseio.com/v0/item/12904458.json?pri...
- parse and roll into your blog.
Wasn't that hard was it?
- Parse Hacker News from multiple sources because no one of them gives you all the information and correlate the info on each.
- Add Reddit, Product Hunt, etc. Probably make it so that it's easy to implement on the back-end. Oh yeah you'll need a back-end because of the previous point.
- Make some cache mechanism according to their robots.txt.
- Optimize the assets.
- Test it in different browsers + smartphones.
Then that'd be rough outline of what I did (or plan on doing), so why repeat all the work when you just want a simple comment thread and not develop/maintain/host the solution yourself?
PS, if you want to do it for learning, please go for it! You'll learn a lot for sure and if you contact me I can give you some tips.
I created hackernews.club
Which shows posts and comments of any HN user.
You can also create a HN profile widget you can embed anywhere. Here's mine.
https://hackernews.club/hacker/profile/sideproject
Love these types of HN tools though!
1. Other people doing something wrong is no justification at all, even though it's a human bias.
2. Other shameless plug was about a comment network for the front-end and back-end which includes HN, so it was not really shameless but an interesting and highly related project.
This is just a random ad from something related to HN but has no kind of relationship with the original post... so please don't SPAM on HN.