about summary refs log tree commit diff stats
path: root/cmd/build/atom.go
diff options
context:
space:
mode:
authorAlan Pearce2024-04-15 08:55:53 +0200
committerAlan Pearce2024-04-16 18:10:12 +0200
commit56b0df9e6c84bbcdaffbde50632e7fdd992791e5 (patch)
tree700639888cd43c0c0181bffd2cb09a3e9f4fb27a /cmd/build/atom.go
parent42a838666aa9da0799dcd3c3d9c6ad0344d1e8d6 (diff)
downloadwebsite-56b0df9e6c84bbcdaffbde50632e7fdd992791e5.tar.lz
website-56b0df9e6c84bbcdaffbde50632e7fdd992791e5.tar.zst
website-56b0df9e6c84bbcdaffbde50632e7fdd992791e5.zip
wip: render feeds
Diffstat (limited to 'cmd/build/atom.go')
-rw-r--r--cmd/build/atom.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/cmd/build/atom.go b/cmd/build/atom.go
new file mode 100644
index 0000000..9116278
--- /dev/null
+++ b/cmd/build/atom.go
@@ -0,0 +1,43 @@
+package main
+
+import (
+	"encoding/xml"
+	"time"
+
+	. "alanpearce.eu/website/internal/config"
+)
+
+func makeTagURI(config Config, specific string) string {
+	return "tag:" + config.OriginalDomain + "," + config.DomainStartDate + ":" + specific
+}
+
+type Link struct {
+	XMLName xml.Name `xml:"link"`
+	Rel     string   `xml:"rel,attr"`
+	Type    string   `xml:"type,attr"`
+	Href    string   `xml:"href,attr"`
+}
+
+func makeLink(url string) Link {
+	return Link{
+		Rel:  "alternate",
+		Type: "text/html",
+		Href: url,
+	}
+}
+
+type FeedContent struct {
+	Content string `xml:",innerxml"`
+	Type    string `xml:"type,attr"`
+}
+
+type FeedEntry struct {
+	XMLName xml.Name    `xml:"entry"`
+	Title   string      `xml:"title"`
+	Link    Link        `xml:"link"`
+	Id      string      `xml:"id"`
+	Updated time.Time   `xml:"updated"`
+	Summary string      `xml:"summary,omitempty"`
+	Author  string      `xml:"author>name"`
+	Content FeedContent `xml:"content"`
+}