89 lines
3.1 KiB
Text
89 lines
3.1 KiB
Text
// Hooks
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
|
// Components
|
|
import Head from 'next/head'
|
|
import { MdxWrapper } from 'shared/components/wrappers/mdx.mjs'
|
|
//import { TocWrapper } from 'shared/components/wrappers/toc.mjs'
|
|
import { PageWrapper, ns } from 'shared/components/wrappers/page.mjs'
|
|
// MDX content for each language
|
|
import EN, { frontmatter as en } from 'markdown/{{{ slug }}}/en.md'
|
|
import ES, { frontmatter as es } from 'markdown/{{{ slug }}}/es.md'
|
|
import FR, { frontmatter as fr } from 'markdown/{{{ slug }}}/fr.md'
|
|
import NL, { frontmatter as nl } from 'markdown/{{{ slug }}}/nl.md'
|
|
import DE, { frontmatter as de } from 'markdown/{{{ slug }}}/de.md'
|
|
|
|
const fm = { en, es, fr, nl, de }
|
|
const mdx = { EN, ES, FR, NL, DE }
|
|
const intro = {
|
|
en: `{{{ introEN }}}`,
|
|
es: `{{{ introES }}}`,
|
|
fr: `{{{ introFR }}}`,
|
|
nl: `{{{ introNL }}}`,
|
|
de: `{{{ introDE }}}`,
|
|
}
|
|
|
|
/*
|
|
* This page is auto-generated by the prebuild script.
|
|
* Any changes you make will be overwritten on the next (pre)build.
|
|
*
|
|
* See the page-templates folder for more info.
|
|
*/
|
|
const DocsPage = ({ page, locale }) => {
|
|
const frontmatter = fm[locale]
|
|
const MDX = mdx[locale.toUpperCase()]
|
|
|
|
return (
|
|
<PageWrapper {...page} title={frontmatter.title}>
|
|
<Head>
|
|
<meta property="og:title" content={frontmatter.title} key="title" />
|
|
<meta property="og:type" content="article" key="type" />
|
|
<meta property="og:description" content={intro} key="type" />
|
|
<meta property="og:article:author" content="Joost De Cock" key="author" />
|
|
<meta
|
|
property="og:image"
|
|
content={`https://canary.backend.freesewing.org/og-img/${page.locale}/org/{{{ slug }}}}`}
|
|
key="image"
|
|
/>
|
|
<meta property="og:image:type" content="image/png" />
|
|
<meta property="og:image:width" content="1200" />
|
|
<meta property="og:image:height" content="630" />
|
|
<meta property="og:url" content={`https://${page.locale === 'en'
|
|
? ''
|
|
: page.locale+'/'}freesewing.org/{{{ slug }}}`} key="url" />
|
|
<meta property="og:locale" content={page.locale} key="locale" />
|
|
<meta property="og:site_name" content="freesewing.org" key="site" />
|
|
<title>{frontmatter.title} - FreeSewing.org</title>
|
|
</Head>
|
|
<div className="flex flex-row-reverse flex-wrap xl:flex-nowrap justify-end">
|
|
{frontmatter.toc && (
|
|
<div className="mb-8 w-full xl:w-80 2xl:w-96 xl:pl-8 2xl:pl-16">
|
|
{/* FIXME: Implement toc plugin to add it to the frontmatter */}
|
|
{/* <TocWrapper toc={frontmatter.toc} /> */}
|
|
</div>
|
|
)}
|
|
<MdxWrapper {...{ MDX, frontmatter }} />
|
|
</div>
|
|
</PageWrapper>
|
|
)
|
|
}
|
|
|
|
export default DocsPage
|
|
|
|
/*
|
|
* getStaticProps() is used to fetch data at build-time.
|
|
* To learn more, see: https://nextjs.org/docs/basic-features/data-fetching
|
|
*/
|
|
export async function getStaticProps({ locale }) {
|
|
const translation = await serverSideTranslations(locale, ['docs', ...ns])
|
|
|
|
return {
|
|
props: {
|
|
locale,
|
|
page: {
|
|
locale,
|
|
path: {{{ slugArray }}},
|
|
},
|
|
...translation,
|
|
},
|
|
}
|
|
}
|