Skip to content

Commit 2e4b9e3

Browse files
committed
Also show syndications on film lists
1 parent ab19d98 commit 2e4b9e3

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

cmd/serve/handlers/films.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,18 @@ func FilmList(w http.ResponseWriter, r *http.Request) {
213213
}
214214
}
215215

216+
syndicationHTML, err := syndication.Render(filmList.Path)
217+
if err != nil {
218+
slog.Error("Failed to render syndications", "path", filmList.Path, "error", err)
219+
}
220+
216221
w.Header().Set("Content-Type", "text/html; charset=utf-8")
217222
w.WriteHeader(http.StatusOK)
218223
err = templates.RenderFilmList(w, templates.FilmListData{
219-
ListTitle: filmList.Title,
220-
Description: renderedDescription,
221-
Entries: filmListItems,
224+
ListTitle: filmList.Title,
225+
Description: renderedDescription,
226+
Entries: filmListItems,
227+
Syndications: template.HTML(syndicationHTML),
222228
PageData: templates.PageData{
223229
Title: fmt.Sprintf("%s · Chameth.com", filmList.Title),
224230
Stylesheet: assets.GetStylesheetPath(),

cmd/serve/templates/film_list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ var filmListTemplate = template.Must(
1818

1919
type FilmListData struct {
2020
PageData
21-
ListTitle string
22-
Description template.HTML
23-
Entries []FilmListItem
21+
ListTitle string
22+
Description template.HTML
23+
Entries []FilmListItem
24+
Syndications template.HTML
2425
}
2526

2627
type FilmListItem struct {

cmd/serve/templates/film_list.html.gotpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
</ol>
2222
{{end}}
2323

24+
{{if .Syndications}}
25+
{{.Syndications}}
26+
{{end}}
27+
2428
<hr class="end-of-post">
2529

2630
<aside><div data-nod></div></aside>

0 commit comments

Comments
 (0)