diff options
-rw-r--r-- | internal/components/data.go | 7 | ||||
-rw-r--r-- | internal/server/mux.go | 15 |
2 files changed, 6 insertions, 16 deletions
diff --git a/internal/components/data.go b/internal/components/data.go index 601102d..3625017 100644 --- a/internal/components/data.go +++ b/internal/components/data.go @@ -4,7 +4,6 @@ import ( "go.alanpearce.eu/searchix/frontend" "go.alanpearce.eu/searchix/internal/config" search "go.alanpearce.eu/searchix/internal/index" - "go.alanpearce.eu/searchix/internal/nix" "github.com/blevesearch/bleve/v2" ) @@ -28,9 +27,3 @@ type ResultData struct { Prev string Next string } - -type DocumentData struct { - TemplateData - Document *nix.Importable - Children *search.Result -} diff --git a/internal/server/mux.go b/internal/server/mux.go index f98e03e..8c34599 100644 --- a/internal/server/mux.go +++ b/internal/server/mux.go @@ -245,20 +245,17 @@ func NewMux( return } - tdata := components.DocumentData{ - TemplateData: components.TemplateData{ - ExtraHeadHTML: cfg.Web.ExtraHeadHTML, - Source: source, - Sources: sources, - Assets: frontend.Assets, - }, - Document: doc, + tdata := components.TemplateData{ + ExtraHeadHTML: cfg.Web.ExtraHeadHTML, + Source: source, + Sources: sources, + Assets: frontend.Assets, } if r.Header.Get("Fetch") == "true" { w.Header().Add("Content-Type", "text/html; charset=utf-8") err = components.Detail(*doc).Render(r.Context(), w) } else { - err = components.DetailPage(tdata.TemplateData, *doc).Render(r.Context(), w) + err = components.DetailPage(tdata, *doc).Render(r.Context(), w) } if err != nil { log.Error("template error", "template", importerSingular, "error", err) |