Skip to content

Instantly share code, notes, and snippets.

@martymcguire
Created February 21, 2019 19:45
Show Gist options
  • Save martymcguire/c6aed07b8a8c36fef23d68930667adfe to your computer and use it in GitHub Desktop.
Save martymcguire/c6aed07b8a8c36fef23d68930667adfe to your computer and use it in GitHub Desktop.
jekyll partial template to render disqus comments. see https://martymcgui.re/2017/04/25/site-updates-importing-old-posts-disqus-comments/
{% if include.page.meta and include.page.meta.dsq_thread_id %}
{% capture comments_content %}
{% for dp in site.data.disqus.disqus.post %}
{% if dp.thread["dsq:id"] == include.page.meta.dsq_thread_id %}
<div class="p-comment h-cite" style="background-color: rgba(255,255,255,{% cycle "0.25", "0.5" %});">
<span class="p-author h-card">
<img class="u-photo" src="{{ dp.author.email | to_gravatar | imageproxy: 30 }}" />
{{ dp.author.name }}
</span> on
<time class="dt-published" datetime="{{ dp.createdAt | date_to_xmlschema }}">{{ dp.createdAt | date: "%B, %-d, %Y" }}</time> said:
<div class="p-name">
{{ dp.message }}
</div>
</div>
{% endif %}
{% endfor %}
{% endcapture %}
{% assign comments_content = comments_content | strip_newlines | strip %}
{% if comments_content != "" %}
<hr />
<h4>Comments</h4>
<div class="mentions">
{{ comments_content }}
</div>
{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment