open-vault/website/pages/api-docs/[[...page]].jsx
Zachary Shilton 3fad03e9ff
website: support hidden pages in nav-data (#11528)
* website: bump to docs-page prerelease, support hidden pages

* website: switch to hidden pages approach for docs and api-docs

* website: remove temporary fix for hidden pages, and related check

* website: fix content structure issue with docs/auth/jwt

* website: bump to latest pre-release

* website: bump to stable docs-page, w next-mdx-remote bump

* website: bump to latest markdown-page
2021-05-06 13:32:25 -04:00

46 lines
1.2 KiB
JavaScript

import { productName, productSlug } from 'data/metadata'
import DocsPage from '@hashicorp/react-docs-page'
// Imports below are used in server-side only
import {
generateStaticPaths,
generateStaticProps,
} from '@hashicorp/react-docs-page/server'
const NAV_DATA_FILE_HIDDEN = 'data/api-docs-nav-data-hidden.json'
const NAV_DATA_FILE = 'data/api-docs-nav-data.json'
const CONTENT_DIR = 'content/api-docs'
const basePath = 'api-docs'
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,
navDataFileHidden: NAV_DATA_FILE_HIDDEN,
localContentDir: CONTENT_DIR,
}),
}
}
export async function getStaticProps({ params }) {
return {
props: await generateStaticProps({
navDataFile: NAV_DATA_FILE,
navDataFileHidden: NAV_DATA_FILE_HIDDEN,
localContentDir: CONTENT_DIR,
product: { name: productName, slug: productSlug },
params,
}),
}
}