From 14b4f3aaf584d13b32f767e37eaff25be8e2a1dc Mon Sep 17 00:00:00 2001 From: partisan Date: Wed, 21 Aug 2024 22:56:21 +0200 Subject: [PATCH] added search suggestions to opensearch --- open-search.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/open-search.go b/open-search.go index 280fe3d..ee3887f 100644 --- a/open-search.go +++ b/open-search.go @@ -12,7 +12,7 @@ type OpenSearchDescription struct { ShortName string `xml:"ShortName"` Description string `xml:"Description"` Tags string `xml:"Tags"` - URL URL `xml:"Url"` + URLs []URL `xml:"Url"` } type URL struct { @@ -28,9 +28,15 @@ func generateOpenSearchXML(config Config) { ShortName: "Search Engine", Description: "Search engine", Tags: "search, engine", - URL: URL{ - Type: "text/html", - Template: fmt.Sprintf("%s/search?q={searchTerms}", baseURL), + URLs: []URL{ + { + Type: "text/html", + Template: fmt.Sprintf("%s/search?q={searchTerms}", baseURL), + }, + { + Type: "application/x-suggestions+json", + Template: fmt.Sprintf("%s/suggestions?q={searchTerms}", baseURL), + }, }, }