Compare commits
7 Commits
v6-dev
...
xmr/opensearch
| Author | SHA1 | Date | |
|---|---|---|---|
| ff0bd51d99 | |||
| fb93bf0f7c | |||
| 4a90884035 | |||
| 2b89ee2c79 | |||
| 612584a140 | |||
| ed8c28a835 | |||
| ecfddb4e38 |
@@ -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:
|
||||
|
||||
@@ -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>
|
||||
@@ -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 -}}
|
||||
|
||||
Reference in New Issue
Block a user