about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--frontend/templates/index.gotmpl6
-rw-r--r--internal/server/server.go2
2 files changed, 5 insertions, 3 deletions
diff --git a/frontend/templates/index.gotmpl b/frontend/templates/index.gotmpl
index c94330a..b829a85 100644
--- a/frontend/templates/index.gotmpl
+++ b/frontend/templates/index.gotmpl
@@ -11,9 +11,9 @@
     <header>
       <nav>
         <h1><a href="/">Searchix</a></h1>
-        <a href="/options/nixos/search">NixOS</a>
-        <a href="/options/darwin/search">Darwin</a>
-        <a href="/options/home-manager/search">Home Manager</a>
+        {{- range $key, $value := .Sources }}
+          <a href="/options/{{ $key }}/search">{{ $value.Name }}</a>
+        {{- end }}
       </nav>
     </header>
     <main>
diff --git a/internal/server/server.go b/internal/server/server.go
index 6b7f31c..e343434 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -63,6 +63,7 @@ const jsSnippet = template.HTML(livereload.JsSnippet) // #nosec G203
 
 type TemplateData struct {
 	LiveReload   template.HTML
+	Sources      map[string]*importer.Source
 	Source       importer.Source
 	Query        string
 	Results      bool
@@ -125,6 +126,7 @@ func New(runtimeConfig *Config) (*Server, error) {
 	mux := http.NewServeMux()
 	indexData := TemplateData{
 		LiveReload: jsSnippet,
+		Sources:    config.Sources,
 	}
 	mux.HandleFunc("/{$}", func(w http.ResponseWriter, _ *http.Request) {
 		err := templates["index"].ExecuteTemplate(w, "index.gotmpl", indexData)