mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-20 20:00:36 +03:00
docs: enable OpenSearch
This commit is contained in:
committed by
XhmikosR
parent
a0d3ddc87b
commit
55c06064f8
@@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
window.docsearch({
|
var search = window.docsearch({
|
||||||
apiKey: '5990ad008512000bba2cf951ccf0332f',
|
apiKey: '5990ad008512000bba2cf951ccf0332f',
|
||||||
indexName: 'bootstrap',
|
indexName: 'bootstrap',
|
||||||
inputSelector: '#search-input',
|
inputSelector: '#search-input',
|
||||||
@@ -50,4 +50,15 @@
|
|||||||
// Set debug to `true` if you want to inspect the dropdown
|
// Set debug to `true` if you want to inspect the dropdown
|
||||||
debug: false
|
debug: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function hashSearch() {
|
||||||
|
if (window.location.hash && window.location.hash.indexOf('#search=') === 0) {
|
||||||
|
search.input.autocomplete.setVal(window.location.hash.slice(8))
|
||||||
|
search.input.autocomplete.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hashSearch()
|
||||||
|
// For the nerds: search by changing the url hash
|
||||||
|
window.addEventListener('hashchange', hashSearch, false)
|
||||||
})()
|
})()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<title>{{ if .IsHome }}{{ .Site.Title | markdownify }} · {{ .Site.Params.description | markdownify }}{{ else }}{{ .Title | markdownify }} · {{ .Site.Title | markdownify }} v{{ .Site.Params.docs_version }}{{ end }}</title>
|
<title>{{ if .IsHome }}{{ .Site.Title | markdownify }} · {{ .Site.Params.description | markdownify }}{{ else }}{{ .Title | markdownify }} · {{ .Site.Title | markdownify }} v{{ .Site.Params.docs_version }}{{ end }}</title>
|
||||||
|
|
||||||
<link rel="canonical" href="{{ .Permalink }}">
|
<link rel="canonical" href="{{ .Permalink }}">
|
||||||
|
<link rel="search" href="/documentation-search.xml" type="application/opensearchdescription+xml">
|
||||||
|
|
||||||
{{ with .Params.robots -}}
|
{{ with .Params.robots -}}
|
||||||
<meta name="robots" content="{{ . }}">
|
<meta name="robots" content="{{ . }}">
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?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>Bootstrap Documentation</ShortName>
|
||||||
|
<Description>Search in the latest Bootstrap documentation</Description>
|
||||||
|
<Image height="16" width="16" type="image/x-icon">https://deploy-preview-29872--twbs-bootstrap.netlify.com/favicon.ico</Image>
|
||||||
|
<Url type="text/html" method="get" template="https://deploy-preview-29872--twbs-bootstrap.netlify.com/docs/4.3/getting-started/introduction/#search={searchTerms}" />
|
||||||
|
</OpenSearchDescription>
|
||||||
Reference in New Issue
Block a user