about summary refs log tree commit diff stats
path: root/templates/homepage.templ
diff options
context:
space:
mode:
Diffstat (limited to 'templates/homepage.templ')
-rw-r--r--templates/homepage.templ42
1 files changed, 42 insertions, 0 deletions
diff --git a/templates/homepage.templ b/templates/homepage.templ
new file mode 100644
index 0000000..aa61c40
--- /dev/null
+++ b/templates/homepage.templ
@@ -0,0 +1,42 @@
+package templates
+
+import (
+	"go.alanpearce.eu/website/internal/config"
+	"go.alanpearce.eu/website/internal/content"
+)
+
+templ Homepage(config *config.Config, posts []content.Post, content string) {
+	@Page(config, PageSettings{
+		Title: config.Title,
+		TitleAttrs: templ.Attributes{
+			"class": "p-name u-url",
+		},
+		Path: "/",
+		BodyAttrs: templ.Attributes{
+			"class": "h-card",
+		},
+	}) {
+		<div id="content">
+			@Unsafe(content)
+		</div>
+		<section>
+			<h2>Latest Posts</h2>
+			@list(posts[0:3])
+		</section>
+		<section>
+			<h2>Elsewhere on the Internet</h2>
+			<ul class="elsewhere">
+				<li>
+					<a class="u-email" rel="me" href={ templ.SafeURL("mailto:" + config.Email) }>
+						{ config.Email }
+					</a>
+				</li>
+				for _, link := range config.Menus["me"] {
+					<li>
+						<a class="u-url" rel="me" href={ templ.SafeURL(link.URL.String()) }>{ link.Name }</a>
+					</li>
+				}
+			</ul>
+		</section>
+	}
+}