Compare commits

...

7 Commits

Author SHA1 Message Date
XhmikosR ff0bd51d99 More 2024-03-12 07:28:26 +02:00
XhmikosR fb93bf0f7c Revert "Add OpenSearch images" 2024-03-12 07:28:26 +02:00
XhmikosR 4a90884035 Add OpenSearch images 2024-03-12 07:28:25 +02:00
XhmikosR 2b89ee2c79 Add InputEncoding 2024-03-12 07:28:25 +02:00
XhmikosR 612584a140 Update search.js 2024-03-12 07:28:25 +02:00
XhmikosR ed8c28a835 Make OpenSearch an output format.
Not sure if there's another way to do this...
2024-03-11 21:05:45 +02:00
Martijn Cuppens ecfddb4e38 docs: enable OpenSearch 2024-03-11 21:05:44 +02:00
4 changed files with 42 additions and 1 deletions
+15
View File
@@ -28,6 +28,21 @@ enableRobotsTXT: true
metaDataFormat: "yaml"
disableKinds: ["404", "taxonomy", "term", "RSS"]
outputFormats:
OpenSearch:
baseName: opensearch
isPlainText: true
mediaType: application/xml
notAlternative: true
outputs:
home:
- HTML
- OpenSearch
page:
- HTML
- OpenSearch
publishDir: "_site"
module:
+15 -1
View File
@@ -13,7 +13,7 @@
const siteDocsVersion = searchElement.getAttribute('data-bd-docs-version')
window.docsearch({
const search = window.docsearch({
apiKey: '3151f502c7b9e9dafd5e6372b691a24e',
indexName: 'bootstrap',
appId: 'AK7KMZKZHQ',
@@ -42,4 +42,18 @@
})
}
})
function hashSearch() {
const SEARCH_WORD = '#search='
if (window.location.hash && window.location.hash.startsWith(SEARCH_WORD)) {
search.input.autocomplete.setVal(window.location.hash.slice(SEARCH_WORD.length))
search.input.autocomplete.open()
}
}
hashSearch()
// For the nerds: search by changing the url hash
window.addEventListener('hashchange', hashSearch, false)
})()
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>{{ .Site.Title }}</ShortName>
<Description>Search {{ .Site.Title }} Documentation</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image type="image/x-icon" width="16" height="16">{{ (urls.JoinPath "/docs" .Site.Params.docs_version "assets/img/favicons/favicon.ico") | absURL }}</Image>
<Url type="text/html" method="get" template="{{ "/" | absURL }}#search={searchTerms}"/>
</OpenSearchDescription>
+4
View File
@@ -11,6 +11,10 @@
<link rel="canonical" href="{{ .Permalink }}">
{{ with .OutputFormats.Get "opensearch" -}}
<link rel="search" href="{{ .Permalink }}" title="{{ $.Site.Title }}" type="application/opensearchdescription+xml">
{{ end -}}
<link rel="preconnect" href="https://AK7KMZKZHQ-dsn.algolia.net" crossorigin>
{{ with .Params.robots -}}