about summary refs log tree commit diff stats
path: root/templates/tags.templ
diff options
context:
space:
mode:
authorAlan Pearce2024-06-24 21:48:36 +0200
committerAlan Pearce2024-06-24 23:09:15 +0200
commita2feb8c63c80a1f52830f562af2deb2c6065eaae (patch)
tree448ed15c5fb91099ef29528c529a35d6151d98ee /templates/tags.templ
parent8623948592fa14958d340b006653fc57861c4fc4 (diff)
downloadwebsite-a2feb8c63c80a1f52830f562af2deb2c6065eaae.tar.lz
website-a2feb8c63c80a1f52830f562af2deb2c6065eaae.tar.zst
website-a2feb8c63c80a1f52830f562af2deb2c6065eaae.zip
move templ templates into separate package
Diffstat (limited to 'templates/tags.templ')
-rw-r--r--templates/tags.templ23
1 files changed, 23 insertions, 0 deletions
diff --git a/templates/tags.templ b/templates/tags.templ
new file mode 100644
index 0000000..7218ca1
--- /dev/null
+++ b/templates/tags.templ
@@ -0,0 +1,23 @@
+package templates
+
+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>
+	}
+}