blog/_includes/comments.html

68 lines
2.4 KiB
HTML
Raw Normal View History

<article><div class="divider"></div></article>
<div class="comment-environment">
<article>
<div class="comment">
<div class="title"><h2>Comments</h2></div>
{% capture mail %}{{ site.author_email }}{% endcapture %}
{% assign mail_substring = mail | split: '@' %}
{% assign mail_username = mail_substring[0] %}
{% assign mail_domain = mail_substring[1] %}
{% if page.is_post %}
{% capture mailto_prefix %}{{ mail_username }}+{{ page.path | remove: ".md" | remove: "_posts/" }}{% endcapture %}
{% else %}
{% capture mailto_prefix %}{{ mail_username }}+{{ page.path | remove: ".html" | remove: ".md" | remove: "_pages/" }}{% endcapture %}
{% endif %}
<div class="title">
<h3>
<a href="mailto:{{ mailto_prefix }}@{{ mail_domain }}">
Post a new comment</a>
</h3>
</div>
{% for comment in site.comments %}
{% assign page_path = page.path | replace: "_posts/", "" | remove: ".md" %}
{% assign comment_fullpath = comment.path | replace: "_comments/", "" | split: "/" %}
{% assign comment_path = comment_fullpath[0] %}
{% assign comment_id = comment_fullpath[1] | remove: ".md" %}
{% if comment_path == page_path %}
{% if forloop.first %}
<div class="divider"></div>
{% endif %}
<div class="comment-headers">
<table>
<tr>
<td>Subject</td>
{% comment %}
<!-- Link to single comment -->
{% endcomment %}
<td><a href="#{{ comment_id }}" id={{ comment_id }}>{{ comment.subject }}</a></td>
</tr>
<tr>
<td>From</td>
<td>{{ comment.from }}</td>
</tr>
<tr>
<td>Date</td>
<td>{{ comment.date | date: "%c, %:z GMT" }}</td>
</tr>
</table>
</div>
{{ comment.content | markdownify }}
{% comment %}
<!-- Don't print the divider after the last comment -->
{% endcomment %}
{% if forloop.last == false %}
<div class="divider"></div>
{% endif %}
{% endif %}
{% endfor %}
</div>
</article>
</div>