package builder import ( "website/internal/config" "path" ) func getContent(filename string) templ.Component { return templ.ComponentFunc(func(ctx context.Context, w io.Writer) error { _, index, err := getPost(path.Join("content", filename)) if err != nil { return err } _, err = io.WriteString(w, string(index)) return err }) } templ homepage(config config.Config, posts []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

} }