1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-15 10:05:40 +02:00

Make OpenSearch an output format.

Not sure if there's another way to do this...
This commit is contained in:
XhmikosR
2020-02-17 18:20:24 +02:00
parent ecfddb4e38
commit ed8c28a835
4 changed files with 23 additions and 8 deletions

View File

@@ -28,6 +28,18 @@ enableRobotsTXT: true
metaDataFormat: "yaml"
disableKinds: ["404", "taxonomy", "term", "RSS"]
outputFormats:
OpenSearch:
baseName: opensearch
isPlainText: true
mediaType: application/xml
notAlternative: true
outputs:
home:
- HTML
- OpenSearch
publishDir: "_site"
module:

View File

@@ -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>{{ .Site.Title }}</ShortName>
<Description>Search {{ .Site.Title }} documentation</Description>
<Image type="image/x-icon" width="16" height="16">{{ (printf "/docs/%s/assets/img/favicons/favicon.ico" .Site.Params.docs_version) | absURL }}</Image>
<Url type="text/html" method="get" template="{{ (printf "/docs/%s/getting-started/introduction/" .Site.Params.docs_version) | absURL }}#search={searchTerms}"/>
</OpenSearchDescription>

View File

@@ -10,7 +10,10 @@
<title>{{ if .IsHome }}{{ .Site.Title | markdownify }} · {{ .Site.Params.subtitle | markdownify }}{{ else }}{{ .Title | markdownify }} · {{ .Site.Title | markdownify }} v{{ .Site.Params.docs_version }}{{ end }}</title>
<link rel="canonical" href="{{ .Permalink }}">
<link rel="search" href="/documentation-search.xml" type="application/opensearchdescription+xml">
{{ 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>

View File

@@ -1,7 +0,0 @@
<?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>