Open schlos opened 3 years ago
OPTION 1) Discourse embedding comments via JS: https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963
OPTION 2) CfP proof-of-concept by Chris: https://codeforphilly.org/discourse/topic/872 & embedded discourse comments look like: http://codeforphilly.org/discourse/topic/246
so in this example you put a discourse topic id into the laddr URL and it loads the content over the api and renders it as a page, and then embeds the comments for that topic:
{extends designs/site.tpl}
{block title}{$fancy_title|escape} — {$dwoo.parent}{/block}
{block content}
<h2>{$fancy_title|escape}</h2>
{$post_stream.posts[0].cooked}
<hr>
{$url = "http://forum.codeforphilly.org/t/$slug/$id"}
Edit or discuss this page at <a href="{$url|escape}">{$url|escape}</a>
<hr>
<div id="discourse-comments"></div>
<script type="text/javascript">
var DiscourseEmbed = {
discourseUrl: '//forum.codeforphilly.org/',
topicId: {$id|json_encode}
};
(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>
{/block}
Option 1) https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963
Replace discourseEmbedUrl: 'http://example.com/blog/entry-123.html'
with:
"http://{Site::getConfig(primary_hostname)}{$Post->getURL()}"
(http OR https??)
We're getting a lot of spam, so we need better mechanism to stop spammers.
Level 1 - Captcha
Level 2 - Make Comments configurable (enable/disable per instance)
Level 3 - Make comments with Discourse comments (configurable)