@@ -10,6 +10,7 @@ import (
1010 "chameth.com/chameth.com/cmd/serve/assets"
1111 "chameth.com/chameth.com/cmd/serve/content"
1212 "chameth.com/chameth.com/cmd/serve/content/markdown"
13+ "chameth.com/chameth.com/cmd/serve/content/shortcodes/filmlist"
1314 "chameth.com/chameth.com/cmd/serve/content/shortcodes/rating"
1415 "chameth.com/chameth.com/cmd/serve/db"
1516 "chameth.com/chameth.com/cmd/serve/templates"
@@ -102,6 +103,21 @@ func Film(w http.ResponseWriter, r *http.Request) {
102103 posterPath = * film .PosterPath
103104 }
104105
106+ lists , err := db .GetFilmListsContainingFilm (film .ID )
107+ if err != nil {
108+ slog .Error ("Failed to get film lists containing film" , "film_id" , film .ID , "error" , err )
109+ }
110+
111+ var filmLists []template.HTML
112+ for _ , list := range lists {
113+ listHTML , err := filmlist .Render (list .ID )
114+ if err != nil {
115+ slog .Error ("Failed to render film list" , "list_id" , list .ID , "error" , err )
116+ } else {
117+ filmLists = append (filmLists , template .HTML (listHTML ))
118+ }
119+ }
120+
105121 w .Header ().Set ("Content-Type" , "text/html; charset=utf-8" )
106122 w .WriteHeader (http .StatusOK )
107123 err = templates .RenderFilm (w , templates.FilmData {
@@ -113,6 +129,7 @@ func Film(w http.ResponseWriter, r *http.Request) {
113129 TimesWatched : timesWatched ,
114130 AverageRating : template .HTML (ratingHTML ),
115131 PosterPath : posterPath ,
132+ FilmLists : filmLists ,
116133 PageData : templates.PageData {
117134 Title : fmt .Sprintf ("%s (%s) · Chameth.com" , film .Title , year ),
118135 Stylesheet : assets .GetStylesheetPath (),
0 commit comments