about summary refs log tree commit diff stats
path: root/internal/builder/post.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 /internal/builder/post.templ
parent8623948592fa14958d340b006653fc57861c4fc4 (diff)
downloadwebsite-a2feb8c63c80a1f52830f562af2deb2c6065eaae.tar.lz
website-a2feb8c63c80a1f52830f562af2deb2c6065eaae.tar.zst
website-a2feb8c63c80a1f52830f562af2deb2c6065eaae.zip
move templ templates into separate package
Diffstat (limited to 'internal/builder/post.templ')
-rw-r--r--internal/builder/post.templ51
1 files changed, 0 insertions, 51 deletions
diff --git a/internal/builder/post.templ b/internal/builder/post.templ
deleted file mode 100644
index 6f12e5c..0000000
--- a/internal/builder/post.templ
+++ /dev/null
@@ -1,51 +0,0 @@
-package builder
-
-import (
-	"time"
-	"website/internal/config"
-	"website/internal/content"
-)
-
-func Unsafe(html string) templ.Component {
-	return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
-		_, err = io.WriteString(w, html)
-		return
-	})
-}
-
-templ postDate(d time.Time) {
-	<time class="dt-published" datetime={ d.UTC().Format(time.RFC3339) }>
-		{ d.Format("2006-01-02") }
-	</time>
-}
-
-templ postPage(config config.Config, post content.Post) {
-	@page(config, PageSettings{
-		Title: post.Title,
-		TitleAttrs: templ.Attributes{
-			"class": "p-author h-card",
-			"rel":   "author",
-		},
-		Path: post.URL,
-	}) {
-		<article class="h-entry">
-			<h1 class="p-name">{ post.Title }</h1>
-			<p>
-				@postDate(post.Date)
-			</p>
-			<div class="e-content">
-				@Unsafe(post.Content)
-			</div>
-			<div class="tags">
-				Tags:
-				<ul class="p-categories tags">
-					for _, tag := range post.Taxonomies.Tags {
-						<li>
-							@tagLink(tag, templ.Attributes{"class": "p-category"})
-						</li>
-					}
-				</ul>
-			</div>
-		</article>
-	}
-}