about summary refs log tree commit diff stats
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/templates/blocks/search.gotmpl2
-rw-r--r--frontend/templates/index.gotmpl10
-rw-r--r--frontend/templates/opensearch.xml.gotmpl16
3 files changed, 26 insertions, 2 deletions
diff --git a/frontend/templates/blocks/search.gotmpl b/frontend/templates/blocks/search.gotmpl
index 3ad05bf..6f47df3 100644
--- a/frontend/templates/blocks/search.gotmpl
+++ b/frontend/templates/blocks/search.gotmpl
@@ -11,6 +11,6 @@
   {{- end }}
 {{- end }}
 
-{{- define "js" }}
+{{- define "head" }}
   <script src="/static/search.js" defer></script>
 {{- end }}
diff --git a/frontend/templates/index.gotmpl b/frontend/templates/index.gotmpl
index 6db4cc2..90f875b 100644
--- a/frontend/templates/index.gotmpl
+++ b/frontend/templates/index.gotmpl
@@ -6,9 +6,17 @@
     <title>Searchix</title>
     <link href="/static/base.css" rel="stylesheet" />
     <link href="/static/style.css" rel="stylesheet" />
-    {{ block "js" . }}
+    {{ block "head" . }}
     {{ end }}
     {{ .ExtraHeadHTML }}
+    {{- range $key, $value := .Sources }}
+      <link
+        rel="search"
+        type="application/opensearchdescription+xml"
+        title="Searchix {{ $value.Name }}"
+        href="/options/{{ $key }}/opensearch.xml"
+      />
+    {{- end }}
   </head>
   <body>
     <header>
diff --git a/frontend/templates/opensearch.xml.gotmpl b/frontend/templates/opensearch.xml.gotmpl
new file mode 100644
index 0000000..8d978ea
--- /dev/null
+++ b/frontend/templates/opensearch.xml.gotmpl
@@ -0,0 +1,16 @@
+<OpenSearchDescription
+  xmlns="http://a9.com/-/spec/opensearch/1.1/"
+  xmlns:moz="http://www.mozilla.org/2006/browser/search/"
+>
+  <ShortName>Searchix {{ .Source.Name }}</ShortName>
+  <LongName>Search {{ .Source.Name }} options with Searchix</LongName>
+  <Description>Search options {{ .Source.Name }}</Description>
+  <Url
+    type="text/html"
+    method="get"
+    template="{{ .BaseURL }}/options/{{ .Source.Key }}/search?query={searchTerms}&amp;from=opensearch"
+  />
+  <moz:SearchForm
+    >{{ .BaseURL }}/options/{{ .Source.Key }}/search</moz:SearchForm
+  >
+</OpenSearchDescription>