Nested replies
This commit is contained in:
parent
db54ca40c6
commit
d0542271a0
13
src/_includes/components/reply.njk
Normal file
13
src/_includes/components/reply.njk
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% macro reply(note) %}
|
||||||
|
<div>
|
||||||
|
<time class="dt-published" datetime="{{ note.createdAt | dateToRfc3339 }}">{{ note.createdAt | dateTimeDisplay }}</time>
|
||||||
|
{{ note.text | md | safe }}
|
||||||
|
{% if note.replies.length %}
|
||||||
|
<ul>
|
||||||
|
{% for r in note.replies %}
|
||||||
|
<li>{{ reply(r) }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: "base.njk"
|
layout: "base.njk"
|
||||||
---
|
---
|
||||||
|
{% import "components/reply.njk" as replyMacros %}
|
||||||
|
|
||||||
<main data-for="note">
|
<main data-for="note">
|
||||||
|
|
||||||
@ -11,23 +12,14 @@ layout: "base.njk"
|
|||||||
<time class="dt-published" datetime="{{ note.createdAt | dateToRfc3339 }}">{{ note.createdAt | dateTimeDisplay }}</time>
|
<time class="dt-published" datetime="{{ note.createdAt | dateToRfc3339 }}">{{ note.createdAt | dateTimeDisplay }}</time>
|
||||||
</div>
|
</div>
|
||||||
{{ content | safe }}
|
{{ content | safe }}
|
||||||
<pre>{{ note.replies | dump }}</pre>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
|
|
||||||
{% for reply in note.replies %}
|
|
||||||
<li>{{ reply.text | md | safe }}</li>
|
<ul>
|
||||||
{% endfor %}
|
{% for reply in note.replies %}
|
||||||
|
<li>
|
||||||
|
{{ replyMacros.reply(reply) }}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{# <ul>
|
|
||||||
{% for reply in note.replies %}
|
|
||||||
<li>
|
|
||||||
<div>
|
|
||||||
<time class="dt-published" datetime="{{ reply.createdAt | dateToRfc3339 }}">{{ reply.createdAt | dateTimeDisplay }}</time>
|
|
||||||
{{ reply.text | md | safe }}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul> #}
|
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
Loading…
Reference in New Issue
Block a user