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/tags.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/tags.templ')
-rw-r--r-- | internal/builder/tags.templ | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/builder/tags.templ b/internal/builder/tags.templ new file mode 100644 index 0000000..14abca4 --- /dev/null +++ b/internal/builder/tags.templ @@ -0,0 +1,23 @@ +package builder + +import "website/internal/config" + +templ tagLink(tag string, attrs templ.Attributes) { + <a { attrs... } href={ templ.SafeURL("/tags/" + tag) }>#{ tag }</a> +} + +templ tagsPage(config config.Config, title string, tags []string, path string) { + @page(config, PageSettings{ + Title: title, + Path: path, + }) { + <h3 class="filter">Tags</h3> + <ul class="tags"> + for _, tag := range tags { + <li class="h-feed"> + @tagLink(tag, templ.Attributes{}) + </li> + } + </ul> + } +} |