Files
blog/templates/post.templ

30 lines
709 B
Plaintext

package templates
templ PostDetail(post models.Post) {
<article class="post-detail">
<h1 class="post-title">{ post.Title }</h1>
<div class="post-meta">
Published: { post.PublishedAt.Format("January 2, 2006") } |
Tags:
for i, tag := range post.Tags {
if i > 0 {
,
}
<a href={ templ.URL("/tags/" + tag) }>{ tag }</a>
}
| { fmt.Sprintf("%d", post.WordCount) } words
</div>
<div class="post-content">
{ templ.Raw(post.Content) }
</div>
<div class="post-footer">
<a href="/"
hx-get="/"
hx-target="main"
hx-push-url="true">
<- Back to Posts
</a>
</div>
</article>
}