40 lines
745 B
Plaintext
40 lines
745 B
Plaintext
package templates
|
|
|
|
import (
|
|
"git.valxntine.dev/valxntine/blog/models"
|
|
"strconv"
|
|
)
|
|
|
|
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") }
|
|
if len(post.Tags) > 0 {
|
|
|
|
|
Tags:
|
|
for i, tag := range post.Tags {
|
|
if i > 0 {
|
|
,
|
|
}
|
|
<a href={ templ.URL("/tags/" + tag) }>{ tag }</a>
|
|
}
|
|
}
|
|
| { strconv.Itoa(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>
|
|
}
|