Add OpenSearch description (#17)

This allows users to add noogle search to their browser toolbar. See https://developer.mozilla.org/en-US/docs/Web/OpenSearch#autodiscovery_of_search_plugins or search.nixos.org
This commit is contained in:
Paul Haerle 2023-01-25 22:45:33 +01:00 committed by GitHub
parent 676a686087
commit a7ded1215c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -49,6 +49,7 @@ const MyApp: React.FunctionComponent<MyAppProps> = (props) => {
<meta />
<meta name="robots" content="all" />
<link rel="icon" href="/favicon.png" />
<link rel="search" type="application/opensearchdescription+xml" title="Search nix function on noogle" href="/search.xml"></link>
</Head>
<CacheProvider value={emotionCache}>

10
public/search.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Noogle</ShortName>
<Description>Search for nix functions by name.</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/png">https://noogle.dev/favicon.png</Image>
<Url type="text/html" template="https://noogle.dev/?term=%22{searchTerms}%22"/>
<moz:SearchForm>https://noogle.dev</moz:SearchForm>
</OpenSearchDescription>