I’ve seen Discourse threads displayed on otherwise “standard” html pages. Has anyone worked on integrating Discourse threads in a Kirby context? For instance, to display the the comments on a blog post?
I think all you really have to do is to copy the js code and add it to your article template for blog posts. There’s nothing to worry about on Kirby’s end.
That’s true!! It would at least need some kind of explanation. While I really like Discourse for the forum, I’m not sure how well it would work for blog comments. There’s also no way to import old comments from something like Disqus as it seems. I was thinking about adding it to the Kirby blog, but those reasons kept me from doing it so far.
@takaminacchan I’m looking for a self hosted commenting solution by myself for several months now.
If you need only commenting you could try https://muut.com/ ‹— Free, but hosted solution. Or, for a self hosted solution http://vanillaforums.org/. Vanilla seems to be a great—and free—forum.
I’m trying to work with Discourse because I’m trying to create a community around my site, and Discourse really seems excellent on that regard. I’ve grabbed a droplet at Digital Ocean ($20 a month), it works like a charm so far - now to get the embedding to work exactly the way I want it to work (shouldn’t be hard, I just haven’t had time to work on it yesterday).
I will definitely need to explain the whole “you need to go to the forum to comment” thing, yup… but it seems appropriate.
EDIT: Actually, not sure it’s this trivial. I’ve embedded the js code (after some modifications to get the pointers to aim at the right URLs, at least supposedly), but so far nothing is coming up except a blank space that wastn’t there before. Example here: http://beckyverse.com/writing/the-edgarverse-chronicles/star-eater (the discourse-comments div is just above the credits section).
Should I try and create an RSS flux, or is there something else I’m missing?
SECOND EDIT: Doesn’t look like it’s working, even with an RSS feed. I’m pretty unexperienced when it comes to RSS though, so maybe that’s just me not being efficient.
You’re adding a JS script to your page, so your best bet is looking at the browser console, to see a) if the script runs and b) if yes, at which point it fails. Your first place to look would be the browser’s console, looking for:
syntax errors
JS exceptions
security warnings
And if there’s nothing there, looking at the network requests (in the Chrome/Firefox devtools as well). To see if a request for your post’s comments is actually going out, what the response is, etc.
Turns out you have a cross-domain security issue:
Load denied by X-Frame-Options: talk.domain.tld/embed/comments?embed_url=http%3A%2F%2Fbeckyverse.com%2Fwriting%2Fthe-edgarverse-chronicles%2Fstar-eater does not permit cross-origin framing.
Looking at the page’s DOM, the script added an <iframe>, but your talk.domain.tld subdomain is not configured to allow embedding on different origins (domains or subdomains). It’s probably a security option that you have to enable, so that talk.yourdomain.tld (aka your Discourse site) sends the right X-Frame-Options header.
(I can’t tell what the right values for X-Frame-Options are, perhaps that’s in the Discourse doc somewhere, or you will have to search a bit.)
I have rebuilt my Discourse server after updating the app.yml file, so I… suppose that part of the issue has been solved (at least, it should be fine on Discourse’s end?).
Unfortunately, still doesn’t work as intended and I’m not sure how to read or react to the error I’m getting.
… But I’m still getting 403. Biggest problem is I’m not sure how to read the error messages (@fvsch, where exactly did you find the “Load denied by X-Frame-Options” line in the log?), so I don’t know where to try and search to advance more.
I got that line in the Firefox console (Ctrl+Shift+K).
I don’t know anything about CORS so I can’t tell your more. But in any case your Discourse instance is still responding with a 403 to the request, so Discourse is still disallowing embedding. It’s probably something you have to configure.