Skip to content

Commit

Permalink
Add support for Disqus comments on distill posts (alshedivat#981)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohandebsarkar authored and zkotti committed Dec 10, 2022
1 parent b9c6739 commit 958cbb0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions _layouts/distill.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,27 @@ <h3>Contents</h3>
<d-citation-list></d-citation-list>
</d-appendix>

<d-bibliography src="{{ page.bibliography | prepend: '/assets/bibliography/' | relative_url }}"></d-bibliography>

{%- if site.disqus_shortname and page.comments -%}
<div id="disqus_thread" style="max-width: 800px; margin: 0 auto"></div>
<script type="text/javascript">
var disqus_shortname = '{{ site.disqus_shortname }}';
var disqus_identifier = '{{ page.id }}';
var disqus_title = {{ page.title | jsonify }};
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
{%- endif %}
</div>

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

<d-bibliography src="{{ page.bibliography | prepend: '/assets/bibliography/' | relative_url }}"></d-bibliography>

{% include scripts/bootstrap.html %}
{% include scripts/analytics.html %}
{% include scripts/progressBar.html %}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h1 class="post-title">{{ page.title }}</h1>
</article>

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

0 comments on commit 958cbb0

Please sign in to comment.