Skip to content

Commit b789a65

Browse files
rohandebsarkarfolguinch
authored andcommitted
Add support for Disqus comments on distill posts (alshedivat#981)
Fixes alshedivat#980.
1 parent e21f737 commit b789a65

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

_layouts/distill.html

+16-2
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,27 @@ <h3>Contents</h3>
9696
<d-citation-list></d-citation-list>
9797
</d-appendix>
9898

99+
<d-bibliography src="{{ page.bibliography | prepend: '/assets/bibliography/' | relative_url }}"></d-bibliography>
100+
101+
{%- if site.disqus_shortname and page.comments -%}
102+
<div id="disqus_thread" style="max-width: 800px; margin: 0 auto"></div>
103+
<script type="text/javascript">
104+
var disqus_shortname = '{{ site.disqus_shortname }}';
105+
var disqus_identifier = '{{ page.id }}';
106+
var disqus_title = {{ page.title | jsonify }};
107+
(function() {
108+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
109+
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
110+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
111+
})();
112+
</script>
113+
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
114+
{%- endif %}
99115
</div>
100116

101117
<!-- Footer -->
102118
{%- include footer.html %}
103119

104-
<d-bibliography src="{{ page.bibliography | prepend: '/assets/bibliography/' | relative_url }}"></d-bibliography>
105-
106120
{% include scripts/bootstrap.html %}
107121
{% include scripts/analytics.html %}
108122
{% include scripts/progressBar.html %}

_layouts/post.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ <h1 class="post-title">{{ page.title }}</h1>
4444
</article>
4545

4646
{%- if site.disqus_shortname and page.comments -%}
47-
<div id="disqus_thread"></div>
47+
<div id="disqus_thread" style="max-width: {{ site.max_width }}; margin: 0 auto"></div>
4848
<script type="text/javascript">
4949
var disqus_shortname = '{{ site.disqus_shortname }}';
5050
var disqus_identifier = '{{ page.id }}';

0 commit comments

Comments
 (0)