all repos — searchix @ 91836fef16532b72d9fd3edbcbe3844d9c541345

Search engine for NixOS, nix-darwin, home-manager and NUR users

perf: move scripts to head to enable fetching in parallel

Alan Pearce
commit

91836fef16532b72d9fd3edbcbe3844d9c541345

parent

1a5c82e2d08accb6330c4164ab987b87157b10ed

3 files changed, 9 insertions(+), 9 deletions(-)

jump to
M frontend/templates/index.gotmplfrontend/templates/index.gotmpl
@@ -6,6 +6,9 @@ <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Searchix</title> <link href="/static/base.css" rel="stylesheet" /> <link href="/static/style.css" rel="stylesheet" /> + {{ block "js" . }} + {{ end }} + {{ .ExtraHeadHTML }} </head> <body> <header>
@@ -33,8 +36,5 @@ <footer>
Made by <a href="https://alanpearce.eu">Alan Pearce</a>. <a href="https://todo.sr.ht/~alanpearce/searchix">Report issues</a> </footer> - {{ block "js" . }} - {{ end }} - {{ .ExtraBodyHTML }} </body> </html>
M internal/config/config.gointernal/config/config.go
@@ -70,7 +70,7 @@ Port int
BaseURL URL SentryDSN string Environment string - ExtraBodyHTML template.HTML + ExtraHeadHTML template.HTML Headers map[string]string }
M internal/server/mux.gointernal/server/mux.go
@@ -46,7 +46,7 @@ Source config.Source
Query string Results bool SourceResult *bleve.SearchResult - ExtraBodyHTML template.HTML + ExtraHeadHTML template.HTML Version VersionInfo }
@@ -102,7 +102,7 @@ top := http.NewServeMux()
mux := http.NewServeMux() mux.HandleFunc("/{$}", func(w http.ResponseWriter, _ *http.Request) { indexData := TemplateData{ - ExtraBodyHTML: config.Web.ExtraBodyHTML, + ExtraHeadHTML: config.Web.ExtraHeadHTML, Sources: config.Importer.Sources, Version: *versionInfo, }
@@ -149,7 +149,7 @@ }
tdata := ResultData[options.NixOption]{ TemplateData: TemplateData{ - ExtraBodyHTML: config.Web.ExtraBodyHTML, + ExtraHeadHTML: config.Web.ExtraHeadHTML, Source: *source, Sources: config.Importer.Sources, Version: *versionInfo,
@@ -209,7 +209,7 @@ return
} err = templates["search"].Execute(w, TemplateData{ - ExtraBodyHTML: config.Web.ExtraBodyHTML, + ExtraHeadHTML: config.Web.ExtraHeadHTML, Sources: config.Importer.Sources, Source: *source, SourceResult: sourceResult,
@@ -227,7 +227,7 @@ mux.Handle("/static/", http.FileServer(http.FS(frontend.Files)))
if liveReload { applyDevModeOverrides(config) - config.Web.ExtraBodyHTML = jsSnippet + config.Web.ExtraHeadHTML = jsSnippet liveReload := livereload.New() liveReload.Start() top.Handle("/livereload", liveReload)