fix: set page description
This commit is contained in:
parent
b3136143aa
commit
c8238c8d9d
|
|
@ -19,6 +19,7 @@ export type SiteLayoutProps = {
|
|||
subscription?: { email?: boolean } | null
|
||||
children: React.ReactNode
|
||||
title?: string | null
|
||||
ogDescription?: string | null
|
||||
}
|
||||
|
||||
export const SiteLayout: React.FC<SiteLayoutProps> = ({
|
||||
|
|
@ -27,13 +28,14 @@ export const SiteLayout: React.FC<SiteLayoutProps> = ({
|
|||
subscription,
|
||||
children,
|
||||
title,
|
||||
ogDescription,
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<SEOHead
|
||||
title={title || ""}
|
||||
siteName={site.name}
|
||||
description={site.description}
|
||||
description={ogDescription ?? site.description}
|
||||
image={getUserContentsUrl(site.icon)}
|
||||
/>
|
||||
<SiteHeader
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export const getServerSideProps: GetServerSideProps = serverSidePropsHandler(
|
|||
trpcState,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
function SitePagePage({
|
||||
|
|
@ -55,7 +55,7 @@ function SitePagePage({
|
|||
}) {
|
||||
const { data: site } = trpc.useQuery(
|
||||
["site", { site: domainOrSubdomain }],
|
||||
{}
|
||||
{},
|
||||
)
|
||||
const { data: subscription } = trpc.useQuery([
|
||||
"site.subscription",
|
||||
|
|
@ -71,12 +71,15 @@ function SitePagePage({
|
|||
},
|
||||
])
|
||||
|
||||
const ogDescription = page?.excerpt ?? page?.rendered?.excerpt
|
||||
|
||||
return (
|
||||
<SiteLayout
|
||||
site={site!}
|
||||
title={page!.title}
|
||||
viewer={viewer}
|
||||
subscription={subscription}
|
||||
ogDescription={ogDescription}
|
||||
>
|
||||
<SitePage page={page!} />
|
||||
</SiteLayout>
|
||||
|
|
|
|||
Loading…
Reference in New Issue