open-consul/website/pages/docs/[[...page]].jsx
Daniel Nephin c2cc9b6bda Update references to the main branch
The main branch is being renamed from master->main. This commit should
update all references to the main branch to the new name.

Co-Authored-By: Mike Morris <mikemorris@users.noreply.github.com>
2021-06-29 17:17:38 -04:00

48 lines
1.2 KiB
JavaScript

import { productName, productSlug } from 'data/metadata'
import DocsPage from '@hashicorp/react-docs-page'
import ConfigEntryReference from 'components/config-entry-reference'
// Imports below are only used server-side
import {
generateStaticPaths,
generateStaticProps,
} from '@hashicorp/react-docs-page/server'
// Configure the docs path
const additionalComponents = { ConfigEntryReference }
const baseRoute = 'docs'
const navDataFile = `data/${baseRoute}-nav-data.json`
const localContentDir = `content/${baseRoute}`
const mainBranch = 'main'
const product = { name: productName, slug: productSlug }
export default function DocsLayout(props) {
return (
<DocsPage
additionalComponents={additionalComponents}
baseRoute={baseRoute}
product={product}
staticProps={props}
/>
)
}
export async function getStaticPaths() {
const paths = await generateStaticPaths({
localContentDir,
navDataFile,
})
return { paths, fallback: false }
}
export async function getStaticProps({ params }) {
const props = await generateStaticProps({
additionalComponents,
localContentDir,
mainBranch,
navDataFile,
params,
product,
})
return { props }
}