diff options
author | Alan Pearce | 2024-06-18 16:46:22 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-18 16:46:22 +0200 |
commit | 1d247493e05cdc659e46cd3d8a01d5da1e893867 (patch) | |
tree | 221e9ee2f5e3f171dfd937f04fae7ad6a33588d8 /internal/builder/list.templ | |
parent | a238c7e0889cbe7dfaa1a700dea30686a4e2139a (diff) | |
download | website-1d247493e05cdc659e46cd3d8a01d5da1e893867.tar.lz website-1d247493e05cdc659e46cd3d8a01d5da1e893867.tar.zst website-1d247493e05cdc659e46cd3d8a01d5da1e893867.zip |
switch to templ for rendering HTML templates
Diffstat (limited to 'internal/builder/list.templ')
-rw-r--r-- | internal/builder/list.templ | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/internal/builder/list.templ b/internal/builder/list.templ new file mode 100644 index 0000000..48563ed --- /dev/null +++ b/internal/builder/list.templ @@ -0,0 +1,48 @@ +package builder + +import "website/internal/config" + +templ tagPage(config config.Config, tag string, posts []Post, path string) { + @page(config, PageSettings{ + Title: tag, + Path: path, + TitleAttrs: templ.Attributes{ + "class": "p-author h-card", + "rel": "author", + }, + }) { + <div class="filter"> + <h3 class="filter">#{ tag }</h3> + <small> + <a href="../">Remove filter</a> + </small> + </div> + @list(posts) + } +} + +templ listPage(config config.Config, posts []Post, path string) { + @page(config, PageSettings{ + Title: config.Title, + TitleAttrs: templ.Attributes{ + "class": "p-author h-card", + "rel": "author", + }, + Path: path, + }) { + @list(posts) + } +} + +templ list(posts []Post) { + <ul class="h-feed"> + for _, post := range posts { + <li class="h-entry"> + <span> + @postDate(post.Date) + </span> + <a class="p-name u-url" href={ templ.SafeURL(post.URL) }>{ post.Title }</a> + </li> + } + </ul> +} |