all repos — homestead @ 8688a232f5958adbdfd36cdbaec68ecab56aaea1

Code for my website

switch to templ for rendering HTML templates

Alan Pearce
commit

8688a232f5958adbdfd36cdbaec68ecab56aaea1

parent

b0b6eacca2cfd0d39f77687a7787543db9833cd1

1 file changed, 23 insertions(+), 0 deletions(-)

changed files
A 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> + } +}