open-vault/website/pages/docs/[[...page]].jsx
Kevin Wang 044a83400a
feat(website): versioned-docs (#13123)
* chore: `react-docs-page`

* feat: data loader

* chore: bump `next-mdx-remote`

* chore: `showVersionSelect`

* chore: bump react docs page

* chore: bump react docs page
2021-12-17 12:58:05 -05:00

42 lines
1.2 KiB
JavaScript

import { productName, productSlug } from 'data/metadata'
import DocsPage from '@hashicorp/react-docs-page'
import Columns from 'components/columns'
import Tag from 'components/inline-tag'
// Imports below are used in server-side only
import { getStaticGenerationFunctions } from '@hashicorp/react-docs-page/server'
const NAV_DATA_FILE = 'data/docs-nav-data.json'
const CONTENT_DIR = 'content/docs'
const basePath = 'docs'
const additionalComponents = { Columns, Tag }
export default function DocsLayout(props) {
return (
<DocsPage
product={{ name: productName, slug: productSlug }}
baseRoute={basePath}
staticProps={props}
additionalComponents={additionalComponents}
/>
)
}
const { getStaticPaths, getStaticProps } = getStaticGenerationFunctions(
process.env.ENABLE_VERSIONED_DOCS === 'true'
? {
strategy: 'remote',
basePath: basePath,
fallback: 'blocking',
revalidate: 360, // 1 hour
product: productSlug,
}
: {
strategy: 'fs',
localContentDir: CONTENT_DIR,
navDataFile: NAV_DATA_FILE,
product: productSlug,
}
)
export { getStaticPaths, getStaticProps }