Embedding Discourse Comments via Javascript

embedding

(Guillaume Lapierre) #59

This would be indeed fairly insecure. To securize things we could have different (hopefully complementary) approches:

  • the category should exists beforehand. This is the first approach I had when I though of this system to put appart posts from different sections of my website (the blog being only one of those)
  • when parsing the Atom feed Discourse could parse the <category/> tags to add to the corresponding posts. Ideally discourse would let me specify a scheme filter for those tags as my Atom feed add categories and keywords as categories under two different schemes (movable type). Parsing a RSS feed on the server, the categories cannot be compromised (well… not easily) and so creating inexisting one should not be an issue. Still I would prefer if those could be child of a parent category (specified on the Atom feed settings maybe)

(Robin Ward) #60

I am definitely wary of putting the category into the embed code for the security reasons @fefrei just brought up.

Having said that, adding it to the feed as a parameter (like embed_by_username) sounds secure and might work for you?


(Guillaume Lapierre) #61

embed_by_username could work if I could add multiple atom feeds with different settings which does not seem to be an option. I can externally merge the 3 different atom feeds to give to discourse but this would involve having something more like embed-username-key-from-feed


(Robin Ward) #62

Sorry I wrote the wrong field name there. embed_username_key_from_feed does exactly that, but you want it for a category right?


(Guillaume Lapierre) #63

Exactly. As i wrote earlier if it had some kind of xpath syntax to match only some catégories based on scheme attribute value it would be perfect


(Jesse Perry) #77

I read this whole thread and couldn’t find an answer, so apologies if it’s already been stated… but is there a way to reverse the order of comments that appear? Specifically, have the latest comment at the top? The first post of a topic isn’t necessarily the best :stuck_out_tongue_winking_eye:

Or better yet… sort the posts that appear by number of likes to the post. Really whet the visitor’s appetite to click over to Discourse :yum: (but that’s more/different work, so in the interim showing latest at the top would be great)


(omfg) #78

Sorting by likes would show disjointed random stuff.


(Robin Ward) #79

Unfortunately not! Our Wordpress plugin offers a “best” filter but the embedding engine does not. I’d definitely support a pull request that added this functionality if someone wants to take a stab at it.


#84

Hey, its a great feature and it worked like a charm, but i ran into a strange error as I am new to this I am not able to find a workaround it…
The comments that are shown on my blog site are being cropped and this is because iframe in <div id="discourse-comments"></div> is not taking the desired height.

I tried using discourse-embed-comments plugin for discourse but in vain.
Any suggestions… ??


#85

I’ve run into quick a puzzler.

My client has their website hosted on Tumblr and I’m trying to implement the embedded comments. I built everything on an alternate account before overwriting their current design and it worked flawlessly. However, when I moved everything over to their account using the exact same code, it won’t generate topics. It’s just stuck on the “loading discussion” bit and the console throws me this:

Refused to display 'http://board.ttvpodcast.com/embed/comments?embed_url=http%3A%2F%2Fttvpodcas…2Fpost%2F135892237137%2Fttv-no-longer-reporting-on-confidential-leaks-this' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.


(Kane York) #86

You need to make sure the domain is permitted in the embedding settings. Go to /admin/customize/embedding and add the second domain.


#87

Yeah, already did that. /=


(Mic Pringle) #88

How does the crawler determine what to use as the content for the new topic?

For instance, is it possible to either a) specify a title, or b) specify a HTML tag that it should use to extract the title?

How does it decide what to use for the content of the topic?


(Krzysztof Madejski) #89

I had the same problem as @TakumaNuva.

Discourse Meta hack helped, but it should run out of the box (if embedding is alllowed then ALLOWALL should be sent or ALLOW-FROM uri when it is more matured).

I’m running discourse v1.5.0.beta10 +114


(Alex Armstrong) #90

@fefrei directed me here from Embedding: How to post to different categories from one site?

I want to do this:

@eviltrout’s suggestion to use a parameter in the feed would work for me. I’d have to build a new feed that combined all the content types, but I don’t think that would be a problem.

I followed the discussion but I take it that it hasn’t been implemented yet, right?


(Robin Ward) #91

No unfortunately that was not implemented. You can post to different categories by using the admin interface, but it is based on the source URL.


(Alex Armstrong) #92

That sounds promising, as my content is structure like so:

http://www.example.com/blog/foo
http://www.example.com/events/bar

And each of these clearly differentiated URLs should pipe to a different category.

But I can’t find out where to do that. Can you point to me some docs or explanation?


(Robin Ward) #93

That isn’t possible right now. Embeddeding into category are based on different domains so unfortunately there is no way to handle that right now.


(Alex Armstrong) #94

Crud. I am in the process of migrating a higher ed community from Ning to Discourse and I thought I was able to do this. My plan was use Discourse as a comment engine for our blog. But we also host events, such as workshops and webinars, that we’d like our users to be able to discuss on our forum.

Is improved category embedding in the roadmap, at all?

If so, I will need some kind of workaround until then. Would I run into trouble if I did the following:

  1. Create a feed that aggregates all content (blogs, events, etc.) and sends it to an “Uncategorized” category on Discourse.
  2. Manually move topics out of “Uncategorized” and into appropriate categories.
  3. On the site use the default discourseEmbedUrl to link to the content on Discourse.

Is Discourse clever enough to link the topic even though I’ve moved it?

Also, is it possible to create a link to the topic without comments?


(Robin Ward) #95

I think we will get around to it eventually, but it’s not on our roadmap any time soon, unfortunately.

Now, regarding your workaround, Discourse should be smart enough to link the topic even if you manually changed its category. I would create a test before going live to confirm you have it working the way you want, but I believe it will work.