templates/page.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | package templates
import (
"go.alanpearce.eu/homestead/internal/content"
g "go.alanpearce.eu/gomponents"
. "go.alanpearce.eu/gomponents/html"
)
func Page(site SiteSettings, page *content.Post) g.Node {
return Layout(site, PageSettings{
Title: page.Title,
TitleAttrs: Attrs{"class": "h-card", "rel": "author"},
}, Article(
Header(
H1(Class("p-name"), g.Text(page.Title)),
P(
Class("meta"),
g.If(!page.Date.IsZero(),
Span(Class("date"),
g.Text("Published: "),
A(Class("u-url"), Href(page.URL), postDate(page.Date, "dt-published")),
),
),
// one commit: not updated
g.Iff(
(page.Date.IsZero() && len(page.Commits) > 0) || len(page.Commits) > 1,
lastUpdated(page),
),
),
),
Div(Class("content"),
page,
),
))
}
|