package main // Each public view has a meta component (kept in the layout's ) and a // body component. The body can be replaced by a custom html/template from // /admin/templates; the starters/*.html files mirror these defaults. templ postItem(p Post, class string) {
{ p.DisplayTitle() }
if p.PublishedDate != nil { }
} templ latestPosts(posts []Post) {
for _, p := range posts {
{ p.DisplayTitle() } if tags := p.TagList(); len(tags) > 0 { }
if p.PublishedDate != nil { }
}
} templ indexMeta(v indexView) { @ogImage(v.siteContext) } templ indexBody(v indexView) { if v.IntroHTML != "" {
@templ.Raw(string(v.IntroHTML))
} if len(v.Posts) == 0 {

no posts yet

}
for _, p := range v.Posts { @postItem(p, "post-item") }
} templ postsMeta(v postsView) { @ogImage(v.siteContext) } templ postsBody(v postsView) {

Posts

if len(v.Posts) == 0 {

no posts yet

}
for _, p := range v.Posts { @postItem(p, "post-item post-item-enhanced") }
} templ pageMeta(v pageView) { @ogImage(v.siteContext) } templ pageBody(v pageView) {
@templ.Raw(string(v.RenderedContent))
} templ postMeta(v postView) { if v.Post.MetaDescription != nil { } if v.Post.MetaImageStr() != "" { } else { @ogImage(v.siteContext) } if v.Post.CanonicalURL != nil { } } // The location icon is from Phosphor Icons: // https://github.com/phosphor-icons/core/blob/main/LICENSE templ postBody(v postView) {
if v.Post.HasTitle() {

{ v.Post.TitleStr() }

} if v.Post.MetaDescription != nil {

{ v.Post.MetaDescriptionStr() }

}
if v.Post.PublishedDate != nil { • } if v.Post.Weather != nil { @templ.Raw(string(v.Weather.Icon))

{ v.Weather.Conditions }

{ v.Weather.Temperature }

•

{ v.Weather.Location }

}
if len(v.Post.TagList()) > 0 {
for _, t := range v.Post.TagList() { { t } }
}
@templ.Raw(string(v.RenderedContent))
}