2020-12-08 23:24:36 +00:00
|
|
|
import { productName, productSlug } from 'data/metadata'
|
|
|
|
import DocsPage from '@hashicorp/react-docs-page'
|
2021-04-07 19:50:38 +00:00
|
|
|
// Imports below are only used server-side
|
2021-04-23 14:51:13 +00:00
|
|
|
/**
|
|
|
|
* DEBT: short term patch for "hidden" docs-sidenav items.
|
|
|
|
* See components/_temp-enable-hidden-pages for details.
|
|
|
|
* Revert to importing from @hashicorp/react-docs-page/server
|
|
|
|
* once https://app.asana.com/0/1100423001970639/1200197752405255/f
|
|
|
|
* is complete.
|
|
|
|
**/
|
2020-12-08 23:24:36 +00:00
|
|
|
import {
|
|
|
|
generateStaticPaths,
|
|
|
|
generateStaticProps,
|
2021-04-23 14:51:13 +00:00
|
|
|
} from 'components/_temp-enable-hidden-pages'
|
2020-12-08 23:24:36 +00:00
|
|
|
|
2021-04-07 19:50:38 +00:00
|
|
|
// Configure the docs path
|
|
|
|
const baseRoute = 'api-docs'
|
|
|
|
const navDataFile = `data/${baseRoute}-nav-data.json`
|
2021-04-23 14:51:13 +00:00
|
|
|
const navDataFileHidden = `data/${baseRoute}-nav-data-hidden.json`
|
2021-04-07 19:50:38 +00:00
|
|
|
const localContentDir = `content/${baseRoute}`
|
|
|
|
const mainBranch = 'master'
|
|
|
|
const product = { name: productName, slug: productSlug }
|
2020-12-08 23:24:36 +00:00
|
|
|
|
|
|
|
export default function ApiDocsLayout(props) {
|
|
|
|
return (
|
2021-04-07 19:50:38 +00:00
|
|
|
<DocsPage baseRoute={baseRoute} product={product} staticProps={props} />
|
2020-12-08 23:24:36 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function getStaticPaths() {
|
2021-04-23 14:51:13 +00:00
|
|
|
const paths = await generateStaticPaths({
|
|
|
|
localContentDir,
|
|
|
|
navDataFile,
|
|
|
|
navDataFileHidden,
|
|
|
|
})
|
2021-04-07 19:50:38 +00:00
|
|
|
return { paths, fallback: false }
|
2020-12-08 23:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function getStaticProps({ params }) {
|
2021-04-07 19:50:38 +00:00
|
|
|
const props = await generateStaticProps({
|
|
|
|
localContentDir,
|
|
|
|
mainBranch,
|
|
|
|
navDataFile,
|
2021-04-23 14:51:13 +00:00
|
|
|
navDataFileHidden,
|
2020-12-08 23:24:36 +00:00
|
|
|
params,
|
2021-04-07 19:50:38 +00:00
|
|
|
product,
|
2020-12-08 23:24:36 +00:00
|
|
|
})
|
2021-04-07 19:50:38 +00:00
|
|
|
return { props }
|
2020-12-08 23:24:36 +00:00
|
|
|
}
|