templ generate, add markdown syntax highlighting, fix stuff

This commit is contained in:
2025-08-17 14:15:46 +00:00
parent 59d82ae563
commit 749d68cdeb
23 changed files with 1106 additions and 135 deletions

View File

@@ -1,29 +1,39 @@
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") } |
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>
<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>
}