Skip to content

Instantly share code, notes, and snippets.

@evert
Last active July 15, 2018 04:47
Show Gist options
  • Save evert/409f5effca5e7fe706bd1c3aad13af9d to your computer and use it in GitHub Desktop.
Save evert/409f5effca5e7fe706bd1c3aad13af9d to your computer and use it in GitHub Desktop.
Embedding comments from _data/comments.json with Jekyll / GH Pages
<li>
{% if include.comment.url %}<a href="{{ include.comment.url }}">{% endif %}
{% if include.comment.avatar %}<img src="{{ include.comment.avatar }}" alt="{{ include.comment.name }}" />{% end
{% if include.comment.url %}</a>{% endif %}
{% if include.comment.url %}<a href="{{ include.comment.url }}">{% endif %}
<span class="author">{{ include.comment.name }}</span>
{% if include.comment.url %}</a>{% endif %}
• <time>{{ include.comment.created | date: "%b %d, %Y" }}</time>
{{ include.comment.message }}
{% if include.comment.children %}
<ul>
{% for child in include.comment.children %}
{% include comment-single.html comment=child %}
{% endfor %}
</ul>
{% endif %}
</li>
<ul>
{% for comment in include.comments %}
{% include comment-single.html comment=comment %}
{% endfor %}
</ul>
{% assign comments = site.data.comments[page.id] %}
{% include comments.html comments=comments %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment