This repository has been archived on 2021-09-20. You can view files and clone it, but cannot push or open issues/pull-requests.
the-flux-of-thought/_includes/comments.html

47 lines
1.8 KiB
HTML

<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>
<h3>
<a href="mailto:{{ mailto_prefix }}@{{ mail_domain }}">
Post a new comment</a>
</h3>
</div>
<div>
{% assign comment_counter = 0 %}
{% assign comments = site.comments | sort | reverse %}
{% for comment in 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 %}
{% assign parity_check = comment_counter | modulo: 2 %}
{% if parity_check == 0 %}
{% assign parity = "even" %}
{% else %}
{% assign parity = "odd" %}
{% endif %}
<a href="#{{ comment_id }}" id="{{ comment_id }}" class="{{ parity }}">
<div>
<div class="from">{{ comment.from }}</div>
<div class="date">{{ comment.date | date: "%b %e %Y, %R %Z" }}</div>
<div></div>
<div><h3>{{ comment.subject }}</h3></div>
{{ comment.content | markdownify }}
</div>
</a>
{% assign comment_counter = comment_counter | plus: 1 %}
{% endif %}
{% endfor %}
</div>
</div>