open-vault/website/pages/guides/[[...page]].jsx
Bryce Kalow b76a56d40c
feat(website): migrates nav data format and updates docs pages (#11242)
* migrates nav data format and updates docs pages

* removes sidebar_title from content files
2021-04-06 13:49:04 -04:00

42 lines
966 B
JavaScript

import { productName, productSlug } from 'data/metadata'
import DocsPage from '@hashicorp/react-docs-page'
import {
generateStaticPaths,
generateStaticProps,
} from '@hashicorp/react-docs-page/server'
const NAV_DATA_FILE = 'data/guides-nav-data.json'
const CONTENT_DIR = 'content/guides'
const basePath = 'guides'
export default function DocsLayout(props) {
return (
<DocsPage
product={{ name: productName, slug: productSlug }}
baseRoute={basePath}
staticProps={props}
/>
)
}
export async function getStaticPaths() {
return {
fallback: false,
paths: await generateStaticPaths({
navDataFile: NAV_DATA_FILE,
localContentDir: CONTENT_DIR,
}),
}
}
export async function getStaticProps({ params }) {
return {
props: await generateStaticProps({
navDataFile: NAV_DATA_FILE,
localContentDir: CONTENT_DIR,
product: { name: productName, slug: productSlug },
params,
}),
}
}