mirror of
https://github.com/hacks-guide/minimal-mistakes.git
synced 2024-11-27 19:00:36 +00:00
javascript to embed comments from discourse forum
The comment system can be changed to embed topics from the Discourse forum software: http://discourse.org/ More details: https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963
This commit is contained in:
parent
9b833feb7d
commit
f6f7d0cd97
@ -18,9 +18,11 @@ teaser : # filename of teaser fallback teaser image placed in
|
||||
# breadcrumbs : false # true, false (default)
|
||||
words_per_minute : 200
|
||||
comments:
|
||||
provider : # false (default), "disqus", "facebook", "google-plus", custom"
|
||||
provider : # false (default), "disqus", "discourse", "facebook", "google-plus", custom"
|
||||
disqus:
|
||||
shortname : # https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
|
||||
discourse:
|
||||
server : # https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963 , e.g.: meta.discourse.org
|
||||
facebook:
|
||||
# https://developers.facebook.com/docs/plugins/comments
|
||||
appid :
|
||||
|
13
_includes/comments-providers/discourse.html
Normal file
13
_includes/comments-providers/discourse.html
Normal file
@ -0,0 +1,13 @@
|
||||
{% if site.comments.discourse.server %}
|
||||
{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
|
||||
<script type="text/javascript">
|
||||
DiscourseEmbed = { discourseUrl: '//{{ site.comments.discourse.server }}/',
|
||||
discourseEmbedUrl: '{{ canonical }}' };
|
||||
(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>
|
||||
<noscript>Please enable JavaScript to view the comments powered by [Discourse](http://forum.beta-europe.org/c/beta/website).</a></noscript>
|
||||
{% endif %}
|
@ -3,6 +3,8 @@
|
||||
{% case site.comments.provider %}
|
||||
{% when "disqus" %}
|
||||
{% include /comments-providers/disqus.html %}
|
||||
{% when "discourse" %}
|
||||
{% include /comments-providers/discourse.html %}
|
||||
{% when "facebook" %}
|
||||
{% include /comments-providers/facebook.html %}
|
||||
{% when "google-plus" %}
|
||||
|
Loading…
Reference in New Issue
Block a user