simplified some loops, added day2.md to test new footer date functionality

This commit is contained in:
2026-03-10 23:59:17 +00:00
parent 18d151e0cf
commit 4ef81c59bf
8 changed files with 83 additions and 23 deletions

View File

@@ -1,6 +1,16 @@
package templates
import "git.valxntine.dev/valxntine/blog/models"
import (
"git.valxntine.dev/valxntine/blog/models"
"time"
)
func GetLastUpdated(p []models.Post) time.Time {
if len(p) == 0 {
return time.Time{}
}
return p[0].PublishedAt
}
templ HomePage(data models.Data) {
@Layout(data.Title) {
@@ -9,6 +19,6 @@ templ HomePage(data models.Data) {
<main>
@PostList(data.Posts, data.CurrentPage, data.TotalPages)
</main>
@Footer()
@Footer(GetLastUpdated(data.Posts))
}
}