refactor: convert comments to a reusable template

This commit is contained in:
httpjamesm 2022-12-29 13:16:16 -05:00
parent e6915ae849
commit b038d2c502
2 changed files with 27 additions and 50 deletions

25
templates/comments.html Normal file
View file

@ -0,0 +1,25 @@
<details class="comments">
<summary>
Show <b>{{ (len .Comments) }} comments</b>
</summary>
<div class="comments-parent">
{{ range $comment := .Comments }}
<div class="comment-parent">
<div class="comment">
<div class="comment-body">
{{ $comment.Text }}
</div>
<div class="comment-author">
Commented {{ $comment.Timestamp }} by
<a
href="https://stackoverflow.com{{ $comment.AuthorURL }}"
target="_blank"
rel="noopener noreferrer"
>{{ $comment.AuthorName }}</a
>.
</div>
</div>
</div>
{{end}}
</div>
</details>