mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
docsearch meta tags
This commit is contained in:
parent
c40c1fa4db
commit
3588d07729
@ -7,6 +7,7 @@
|
||||
import React, { StatelessComponent } from "react";
|
||||
import Helmet from "react-helmet";
|
||||
import { useStaticQuery, graphql } from "gatsby";
|
||||
import { getCurrentVersion } from '../utils/nodes';
|
||||
|
||||
interface MetaProp {
|
||||
name: string,
|
||||
@ -71,6 +72,11 @@ const SEO: StatelessComponent<SEOProps> = ({ description, lang, meta, title }) =
|
||||
{
|
||||
name: `twitter:description`,
|
||||
content: metaDescription
|
||||
},
|
||||
{
|
||||
name: `docsearch:version`,
|
||||
content: getCurrentVersion(),
|
||||
|
||||
}
|
||||
].concat(meta)}
|
||||
/>
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React from 'react'
|
||||
import { StatelessComponent, ReactElement, useEffect } from 'react';
|
||||
import { navigateTo } from "gatsby-link"
|
||||
import { getCurrentVersion } from '../utils/nodes';
|
||||
|
||||
interface SearchBoxProps {
|
||||
identifier: string;
|
||||
@ -26,13 +27,14 @@ const SearchBox: StatelessComponent<SearchBoxProps> = ({ identifier }): ReactEle
|
||||
);
|
||||
if(window.docsearch){
|
||||
window.docsearch({
|
||||
algoliaOptions: {
|
||||
facetFilters: [`version:${getCurrentVersion()}`],
|
||||
hitsPerPage: 5,
|
||||
},
|
||||
apiKey: process.env.GATSBY_DOCSEARCH_API_KEY,
|
||||
debug: true,
|
||||
indexName: process.env.GATSBY_DOCSEARCH_INDEX,
|
||||
inputSelector: `#${identifier}`,
|
||||
algoliaOptions: {
|
||||
hitsPerPage: 5
|
||||
},
|
||||
debug: true
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user