Meta titles and desc

This commit is contained in:
2023-07-09 23:28:56 +04:00
parent 6194862e6f
commit 5acaeccb70
4 changed files with 26 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
import { Box, Heading } from '@chakra-ui/react'
import Head from 'next/head'
export const getStaticPaths = async () => {
const url = new URL(`${process.env.NEXT_PUBLIC_DIRECTUS_API_URL}/items/pages`)
@@ -26,12 +27,13 @@ export const getStaticProps = async ({ params: { slug } }) => {
data: [page],
} = await res.json()
return { props: page }
return { props: { page } }
}
export default function Page(page) {
export default function Page({ globals, page }) {
return (
<Box className="page">
<Head>{page.title && <title>{[page.title, globals.meta_title].join(' — ')}</title>}</Head>
<Heading>{page.title}</Heading>
<div dangerouslySetInnerHTML={{ __html: page.content }}></div>
</Box>