diff --git a/web/html/feed.html b/web/html/feed.html
index c32f0da..b00a500 100644
--- a/web/html/feed.html
+++ b/web/html/feed.html
@@ -1,55 +1,5 @@
{{ define "title" }}{{ if .Items }}({{ len .Items }}) {{ end }}Intake{{ end }}
-{{ define "buttons" -}}
-
-
-{{- if .Link }}⇗
-{{ end -}}
-{{ end }}
-
-{{ define "item-title" -}}
-{{ or .Title .Id | raw }}
-{{- end }}
-
-{{ define "item" -}}
-
-
- {{/* The item title is a clickable if there is body content */}}
- {{ if .Body }}
-
-
- {{ template "buttons" . }}
- {{ template "item-title" . }}
-
- {{ if .Body }}
- {{ raw .Body }}
- {{ end }}
-
- {{ template "buttons" . }}
- {{ else }}
- {{ template "buttons" . }}
- {{ template "item-title" . }}
- {{ end }}
- {{/* end if .Body */}}
-
- {{/* author/time footer line */}}
- {{ if or .Author .Time }}
-
- {{ .Author }}
- {{ .Time | tsToDate }}
-
- {{ end }}
-
- {{/* source/id/created footer line */}}
-
- {{ .Source }}/{{ .Id }}
- {{ .Created | tsToDate }}
-
-
-
-{{ end }}
-{{/* end define "item" */}}
-
{{ define "content" -}}
@@ -67,7 +17,6 @@
-{{/* if .Items */}}
{{ else }}
Feed is empty
diff --git a/web/html/html.go b/web/html/html.go
index 539a8d3..a884b27 100644
--- a/web/html/html.go
+++ b/web/html/html.go
@@ -29,8 +29,9 @@ var Stylesheet []byte
//go:embed *.html
var templates embed.FS
-func load(file string) *template.Template {
- return template.Must(template.New("layout.html").Funcs(funcs).ParseFS(templates, "layout.html", file))
+func load(files ...string) *template.Template {
+ files = append([]string{"layout.html"}, files...)
+ return template.Must(template.New("layout.html").Funcs(funcs).ParseFS(templates, files...))
}
var home = load("home.html")
@@ -47,7 +48,7 @@ func Home(writer io.Writer, data HomeData) error {
return home.Execute(writer, data)
}
-var feed = load("feed.html")
+var feed = load("feed.html", "item.html")
type FeedData struct {
Items []core.Item
diff --git a/web/html/item.html b/web/html/item.html
new file mode 100644
index 0000000..0cf60b8
--- /dev/null
+++ b/web/html/item.html
@@ -0,0 +1,49 @@
+{{ define "buttons" -}}
+
+
+{{- if .Link }}⇗
+{{ end -}}
+{{ end }}
+
+{{ define "item-title" -}}
+{{ or .Title .Id | raw }}
+{{- end }}
+
+{{ define "item" -}}
+
+
+{{/* The item title is a clickable if there is body content */}}
+{{ if .Body }}
+
+
+ {{ template "buttons" . }}
+ {{ template "item-title" . }}
+
+{{ if .Body }}
+{{ raw .Body }}
+{{ end }}
+
+{{ template "buttons" . }}
+{{ else }}
+{{ template "buttons" . }}
+{{ template "item-title" . }}
+{{ end }}
+{{/* end if .Body */}}
+
+{{/* author/time footer line */}}
+{{ if or .Author .Time }}
+
+{{ .Author }}
+{{ .Time | tsToDate }}
+
+{{ end }}
+
+{{/* source/id/created footer line */}}
+
+{{ .Source }}/{{ .Id }}
+{{ .Created | tsToDate }}
+
+
+
+{{ end }}
+{{/* end define "item" */}}