From a1dfc548198a1326e71f1dd70303a5d3441f7a39 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Jun 2024 13:02:08 +0200 Subject: refactor: switch to templ for HTML templates --- internal/components/data.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 internal/components/data.go (limited to 'internal/components/data.go') diff --git a/internal/components/data.go b/internal/components/data.go new file mode 100644 index 0000000..64caeaa --- /dev/null +++ b/internal/components/data.go @@ -0,0 +1,37 @@ +package components + +import ( + "searchix/frontend" + "searchix/internal/config" + search "searchix/internal/index" + "searchix/internal/nix" + + "github.com/blevesearch/bleve/v2" +) + +type TemplateData struct { + Sources []*config.Source + Source config.Source + Query string + Results bool + SourceResult *bleve.SearchResult + ExtraHeadHTML string + Code int + Message string + Assets *frontend.AssetCollection +} + +type ResultData struct { + TemplateData + Query string + ResultsPerPage int + Results *search.Result + Prev string + Next string +} + +type DocumentData struct { + TemplateData + Document *nix.Importable + Children *search.Result +} -- cgit 1.4.1