package templates
import (
"alin.ovh/homestead/domain/content"
"alin.ovh/homestead/domain/web/templates"
g "alin.ovh/gomponents"
. "alin.ovh/gomponents/html"
)
func Page(site templates.SiteSettings, page *content.Post) g.Node {
return templates.Layout(site, templates.PageSettings{
Title: page.Title,
TitleAttrs: templates.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,
),
))
}
domain/content/templates/page.go (view raw)