use next seo on slug page

This commit is contained in:
tmshv committed 2022-09-06 15:21:04 +03:00
1 parent a4ea8230e4
commit d44db287de
1 file changed
+26 -4
+26 -4
View File
@@ -2,7 +2,7 @@ import Head from "next/head"
import { App } from "src/components/App" import { App } from "src/components/App"
import { tail } from "lodash" import { tail } from "lodash"
import { Page } from "src/components/Page" import { Page } from "src/components/Page"
import { Meta } from "src/components/Meta" import { NextSeo } from "next-seo"
import { MetaBuilder } from "src/lib/meta" import { MetaBuilder } from "src/lib/meta"
import { apiGet } from "@/next-lib" import { apiGet } from "@/next-lib"
import { GetStaticProps, NextPage } from "next" import { GetStaticProps, NextPage } from "next"
@@ -57,6 +57,30 @@ const Index: NextPage<Props> = props => {
} }
return ( return (
<>
{!props.meta ? null : (
<NextSeo
title={props.meta.title}
description={props.meta.description}
canonical="https://art.shlisselburg.org/"
openGraph={{
url: props.meta.url,
title: props.meta.title,
description: props.meta.description,
images: [
{
url: props.meta.image,
width: props.meta.imageWidth,
height: props.meta.imageHeight,
alt: props.meta.description,
type: "image/jpeg",
},
],
site_name: props.meta.siteName,
}}
/>
)}
<App <App
contentStyle={{ contentStyle={{
marginTop: "var(--size-l)", marginTop: "var(--size-l)",
@@ -67,9 +91,6 @@ const Index: NextPage<Props> = props => {
> >
<Head> <Head>
<title>{props.title}</title> <title>{props.title}</title>
{!props.meta ? null : (
<Meta meta={props.meta} />
)}
</Head> </Head>
<Page <Page
@@ -145,6 +166,7 @@ const Index: NextPage<Props> = props => {
</article> </article>
</Page> </Page>
</App> </App>
</>
) )
} }