open-consul/website/pages/commands/[[...page]].jsx
Kevin Wang 3561dfb5f2
feat: versioned-docs (#11327)
This PR introduces versioned docs
2022-01-13 16:10:33 -05:00

36 lines
1 KiB
JavaScript

import { productName, productSlug } from 'data/metadata'
import DocsPage from '@hashicorp/react-docs-page'
// Imports below are only used server-side
import { getStaticGenerationFunctions } from '@hashicorp/react-docs-page/server'
// Configure the docs path
const baseRoute = 'commands'
const navDataFile = `data/${baseRoute}-nav-data.json`
const localContentDir = `content/${baseRoute}`
const product = { name: productName, slug: productSlug }
export default function CommandsLayout(props) {
return (
<DocsPage baseRoute={baseRoute} product={product} staticProps={props} />
)
}
const { getStaticPaths, getStaticProps } = getStaticGenerationFunctions(
process.env.ENABLE_VERSIONED_DOCS === 'true'
? {
strategy: 'remote',
basePath: baseRoute,
fallback: 'blocking',
revalidate: 360, // 1 hour
product: productSlug,
}
: {
strategy: 'fs',
localContentDir: localContentDir,
navDataFile: navDataFile,
product: productSlug,
}
)
export { getStaticPaths, getStaticProps }