// Dependencies import Head from 'next/head' import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { mdxLoader } from 'shared/mdx/loader.mjs' import { jargon } from 'site/jargon.mjs' import mdxMeta from 'site/prebuild/mdx.js' // Components import { MdxWrapper } from 'shared/components/wrappers/mdx.mjs' import { TocWrapper } from 'shared/components/wrappers/toc.mjs' import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs' import { components } from 'site/components/mdx/index.mjs' // Translation namespaces used on this page const namespaces = [...new Set(['docs', ...pageNs])] /* * Each page MUST be wrapped in the PageWrapper component. * You also MUST spread props.page into this wrapper component * when path and locale come from static props (as here) * or set them manually. */ const DocsIndexPage = ({ page, mdx, toc, intro }) => ( {typeof page.t === 'string' ? page.t : ''} - FreeSewing.org
{toc && (
)}
) /* * Default export is the NextJS page object */ export default DocsIndexPage /* * getStaticProps() is used to fetch data at build-time. * * On this page, it is loading the mdx (markdown) content * from the markdown file on disk. * * This, in combination with getStaticPaths() below means this * page will be used to render/generate all markdown/mdx content. * * To learn more, see: https://nextjs.org/docs/basic-features/data-fetching */ export async function getStaticProps({ locale }) { const { mdx, intro, toc } = await mdxLoader(locale, 'org', 'docs', jargon[locale]) return { props: { mdx, toc, intro: intro.join(' '), page: { path: ['docs'], locale, ...mdxMeta[locale]['docs'], }, ...(await serverSideTranslations(locale, namespaces)), }, } }