package builder import ( "website/internal/config" "path" "website/internal/content" ) func getContent(filename string) templ.Component { return templ.ComponentFunc(func(ctx context.Context, w io.Writer) error { _, index, err := content.GetPost(path.Join("content", filename)) if err != nil { return err } _, err = io.WriteString(w, string(index)) return err }) } templ homepage(config config.Config, posts []content.Post) { @page(config, PageSettings{ Title: config.Title, TitleAttrs: templ.Attributes{ "class": "p-name u-url", }, Path: "/", BodyAttrs: templ.Attributes{ "class": "h-card", }, }) {
@getContent("_index.md")

Latest Posts

@list(posts[0:3])

Elsewhere on the Internet

} }