From ba1be9573ef20d6424ae987257a1c727c47d4b53 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Tue, 6 Oct 2026 20:46:31 +0300 Subject: Initial setup for website rewrite --- website.templ | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 website.templ (limited to 'website.templ') diff --git a/website.templ b/website.templ new file mode 100644 index 0000000..a3f137a --- /dev/null +++ b/website.templ @@ -0,0 +1,81 @@ +package main + +import "fmt" + +// 1. Shared Base Layout Component +templ PageLayout(title string) { + + + + + { title } + + + + + +
+ { children... } + + +} + +// 2. Page 1: Home +templ HomePage() { + @PageLayout("Home") { +

Home

+

Go server running with Templ templates and Air hot-reloading.

+ } +} + +// 3. Page 2: About +templ AboutPage() { + @PageLayout("About") { +

About

+

Single-binary web app using Go's standard library net/http.

+ } +} + +// Data struct for dynamic rendering +type Item struct { + Name string + Active bool +} + +// 4. Page 3: Dynamic Data (Conditionals + Loops) +templ ItemsPage(items []Item) { + @PageLayout("Items") { +

Items

+
+ if len(items) == 0 { +

No items in database.

+ } else { + + } +
+

+ { fmt.Sprintf("Total items processed: %d", len(items)) } +

+ } -- cgit v1.3.1