all repos — homestead @ 1d3951219bb1a254c618b1d4a6a5e492981c7926

Code for my website

pass rendered html to homepage

Alan Pearce
commit

1d3951219bb1a254c618b1d4a6a5e492981c7926

parent

7857dae1f6acb57eb60bac9c03744d15d3d2bde4

1 file changed, 2 insertions(+), 15 deletions(-)

changed files
M internal/builder/homepage.templinternal/builder/homepage.templ
@@ -2,23 +2,10 @@ 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) { +templ homepage(config config.Config, posts []content.Post, content string) { @page(config, PageSettings{ Title: config.Title, TitleAttrs: templ.Attributes{
@@ -30,7 +17,7 @@ "class": "h-card",
}, }) { <div id="content"> - @getContent("_index.md") + @Unsafe(content) </div> <section> <h2>Latest Posts</h2>