{% if comments[parent_id] %} {% for comment in comments[parent_id] %} {# The id="" is used as anchor #}
{# Username #} {{ comment.username }} {% include 'vote.twig' with { target: 'comment', hash_id: comment.hashId, vote: votes[comment.id] is defined ? votes[comment.id].vote : null, vote_count: comment.vote, user: user is defined ? user : null } only %} {# DateTime #} {{ comment.created|ago }} {% if user %} — {# Reply #} Reply {% if comment.userId == user.id %} {# Edit #} Edit {% endif %} {% endif %}
{{ comment.text|markdown|raw }}
{# Add replies #} {% include 'comment.twig' with { 'post': post, 'comments': comments, 'votes': votes, 'parent_id': comment.id, 'depth': depth + 1 } %} {% endfor %} {% endif %}