simplified some loops, added day2.md to test new footer date functionality
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user