Jane_Jojo
(Jane Jojo)
1
I have incorporated Discourse into my blog via
This is the code I used
<div id='discourse-comments'></div>
<script type="text/rocketscript">
DiscourseEmbed = { discourseUrl: 'https://comments.alittlebitofspice.com/',
topicId: };
if(!DiscourseEmbed.topicId)
DiscourseEmbed.discourseEmbedUrl = 'https://www.alittlebitofspice.com/cauliflower-rice-stir-fry-with-eggs-paleo-keto-gluten-free-recipe';
(function() {
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
})();
</script>
Everything works except when topid is empty (for a new post).
How do I instruct discourse to create a new topic?
if(!DiscourseEmbed.topicId)
DiscourseEmbed.discourseEmbedUrl = 'https://www.alittlebitofspice.com/cauliflower-rice-stir-fry-with-eggs-paleo-keto-gluten-free-recipe';
Does not seem to work
Here’s my blog post
and my embedding setup
You may be able to create a Topic on Your discourse using the WP-Discourse Plugin.
are You using it?
gerhard
(Gerhard Schlager)
3
Since you are using WordPress, I’d also recommend you look into the wp-discourse plugin. It should make your life a lot easier.
A few notes to your usage of the embedding feature:
- You only need to use
topicId
when you want to point to an existing topic that wasn’t created by embedding.
- Otherwise it should be fine to always use the
discourseEmbedUrl
with the URL of the blog post.
2 Likes
Jane_Jojo
(Jane Jojo)
4
Thanks. WP-Discourse had too many issues.
So I can change the code to
DiscourseEmbed = { discourseUrl: 'http://discourse.example.com/',
discourseEmbedUrl: 'http://example.com/blog/entry-123.html' };
and it should work, right?
2 Likes
This topic was automatically closed after 2339 days. New replies are no longer allowed.