diff options
author | Alan Pearce | 2024-06-18 20:19:05 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-18 20:19:05 +0200 |
commit | 1f9f24e2cef08f40fe2597b3644d08b28e31d370 (patch) | |
tree | b5157b49e8777335b54738ceada783450e8570e4 /internal/builder/homepage.templ | |
parent | b27c96688785372787eb5c3c71a32767fab71ac4 (diff) | |
download | website-1f9f24e2cef08f40fe2597b3644d08b28e31d370.tar.lz website-1f9f24e2cef08f40fe2597b3644d08b28e31d370.tar.zst website-1f9f24e2cef08f40fe2597b3644d08b28e31d370.zip |
pass rendered html to homepage
Diffstat (limited to 'internal/builder/homepage.templ')
-rw-r--r-- | internal/builder/homepage.templ | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/internal/builder/homepage.templ b/internal/builder/homepage.templ index 1df401b..df5bc32 100644 --- a/internal/builder/homepage.templ +++ b/internal/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 @@ templ homepage(config config.Config, posts []content.Post) { }, }) { <div id="content"> - @getContent("_index.md") + @Unsafe(content) </div> <section> <h2>Latest Posts</h2> |