mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
Store context in site metadata
This commit is contained in:
parent
d59778b795
commit
fd6dcf27be
@ -1,2 +1,3 @@
|
|||||||
GATSBY_DOCSEARCH_API_KEY=0ca39e6ea6a622b335fc0c71482aff54
|
GATSBY_DOCSEARCH_API_KEY=0ca39e6ea6a622b335fc0c71482aff54
|
||||||
GATSBY_DOCSEARCH_INDEX=silverstripe
|
GATSBY_DOCSEARCH_INDEX=silverstripe
|
||||||
|
DOCS_CONTEXT=docs
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -68,3 +68,6 @@ yarn-error.log
|
|||||||
.pnp.js
|
.pnp.js
|
||||||
# Yarn Integrity file
|
# Yarn Integrity file
|
||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
|
|
||||||
|
static/_redirects
|
||||||
|
public/_redirects
|
@ -3,9 +3,10 @@ const path = require('path');
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
siteMetadata: {
|
siteMetadata: {
|
||||||
title: `Silverstripe CMS Documentation`,
|
title: `Silverstripe CMS Documentation`,
|
||||||
description: `Developer documentation for the Silverstripe CMS and framework.`,
|
description: `Developer and user documentation for the Silverstripe CMS and framework.`,
|
||||||
author: `The Silverstripe Community`,
|
author: `The Silverstripe Community`,
|
||||||
siteUrl: `https://doc.silverstripe.org`,
|
siteUrl: `https://doc.silverstripe.org`,
|
||||||
|
context: process.env.DOCS_CONTEXT,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
`gatsby-plugin-react-helmet`,
|
`gatsby-plugin-react-helmet`,
|
||||||
|
@ -28,6 +28,7 @@ const SEO: StatelessComponent<SEOProps> = ({ description, lang, meta, title }) =
|
|||||||
title
|
title
|
||||||
description
|
description
|
||||||
author
|
author
|
||||||
|
context
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,7 +80,7 @@ const SEO: StatelessComponent<SEOProps> = ({ description, lang, meta, title }) =
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `docsearch:context`,
|
name: `docsearch:context`,
|
||||||
content: process.env.DOCS_CONTEXT,
|
content: site.siteMetadata.context,
|
||||||
},
|
},
|
||||||
].concat(meta)}
|
].concat(meta)}
|
||||||
/>
|
/>
|
||||||
|
@ -19,7 +19,9 @@ const autocompleteSelected = (e) => {
|
|||||||
const SearchBox: StatelessComponent<SearchBoxProps> = ({ identifier }): ReactElement|null => {
|
const SearchBox: StatelessComponent<SearchBoxProps> = ({ identifier }): ReactElement|null => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof window === 'undefined') return;
|
if (typeof window === 'undefined') return;
|
||||||
|
if (!process.env.GATSBY_DOCSEARCH_API_KEY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
`autocomplete:selected`,
|
`autocomplete:selected`,
|
||||||
autocompleteSelected,
|
autocompleteSelected,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user