mirror of
https://github.com/acid-info/logos-press-engine.git
synced 2025-02-23 22:58:08 +00:00
refactor: refactor og-related components
This commit is contained in:
parent
c151be526c
commit
7eff12b7d8
@ -39,6 +39,7 @@ export default function SEO({
|
|||||||
image?.alt && ogSearchParams.set('alt', image?.alt || '')
|
image?.alt && ogSearchParams.set('alt', image?.alt || '')
|
||||||
contentType && ogSearchParams.set('contentType', contentType)
|
contentType && ogSearchParams.set('contentType', contentType)
|
||||||
date && ogSearchParams.set('date', date || '')
|
date && ogSearchParams.set('date', date || '')
|
||||||
|
pagePath && ogSearchParams.set('pagePath', pagePath || '')
|
||||||
|
|
||||||
const ogUrl = `${imageUrl}?${ogSearchParams.toString()}`
|
const ogUrl = `${imageUrl}?${ogSearchParams.toString()}`
|
||||||
|
|
||||||
@ -62,11 +63,7 @@ export default function SEO({
|
|||||||
<meta name="twitter:card" content="summary_large_image" />
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
<meta name="twitter:url" content={pageURL ?? `${SITE_URL}${pagePath}`} />
|
<meta name="twitter:url" content={pageURL ?? `${SITE_URL}${pagePath}`} />
|
||||||
<meta name="twitter:site" content="@TWITTERHANDLE" />
|
<meta name="twitter:site" content="@TWITTERHANDLE" />
|
||||||
{image ? (
|
<meta property="twitter:image" content={ogUrl} />
|
||||||
<meta name="twitter:image" content={image.url} />
|
|
||||||
) : (
|
|
||||||
<meta property="twitter:image" content={imageUrl} />
|
|
||||||
)}
|
|
||||||
<link rel="canonical" href={`${SITE_URL}${pagePath}`} />
|
<link rel="canonical" href={`${SITE_URL}${pagePath}`} />
|
||||||
</Head>
|
</Head>
|
||||||
)
|
)
|
||||||
|
@ -11,6 +11,7 @@ const NotFoundPage = () => {
|
|||||||
description={'Description'}
|
description={'Description'}
|
||||||
imageUrl={undefined}
|
imageUrl={undefined}
|
||||||
tags={[]}
|
tags={[]}
|
||||||
|
pagePath={`/404`}
|
||||||
/>
|
/>
|
||||||
<NotFound />
|
<NotFound />
|
||||||
</>
|
</>
|
||||||
|
@ -32,6 +32,7 @@ const Page: CustomNextPage<PageProps> = ({
|
|||||||
'Logos online publishing and blogging platform for writers and readers.'
|
'Logos online publishing and blogging platform for writers and readers.'
|
||||||
}
|
}
|
||||||
title={`${data.page.title} - Logos Press Engine`}
|
title={`${data.page.title} - Logos Press Engine`}
|
||||||
|
pagePath={`/${data.page.slug}`}
|
||||||
/>
|
/>
|
||||||
<StaticPage data={data} />
|
<StaticPage data={data} />
|
||||||
</>
|
</>
|
||||||
|
@ -21,10 +21,12 @@ export default async function handler(request: NextRequest) {
|
|||||||
).then((res) => res.arrayBuffer())
|
).then((res) => res.arrayBuffer())
|
||||||
|
|
||||||
const searchParams = new URL(href).searchParams
|
const searchParams = new URL(href).searchParams
|
||||||
const title = searchParams.get('title') || 'LOGOS→PRESS ENGINE'
|
const contentType = searchParams.get('contentType')
|
||||||
|
const title =
|
||||||
|
contentType == null ? 'LOGOS→PRESS ENGINE' : searchParams.get('title')
|
||||||
const image = searchParams.get('image') || ''
|
const image = searchParams.get('image') || ''
|
||||||
const alt = searchParams.get('alt') || ''
|
const alt = searchParams.get('alt') || ''
|
||||||
const contentType = searchParams.get('contentType')
|
const pagePath = searchParams.get('pagePath') || '/'
|
||||||
const date = searchParams.get('date')
|
const date = searchParams.get('date')
|
||||||
|
|
||||||
const imgSrc = image
|
const imgSrc = image
|
||||||
@ -120,7 +122,7 @@ export default async function handler(request: NextRequest) {
|
|||||||
fontFamily: 'Inter',
|
fontFamily: 'Inter',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<p>{contentType ?? '/'}</p>
|
<p>{contentType ?? pagePath}</p>
|
||||||
{date && <p>∙</p>}
|
{date && <p>∙</p>}
|
||||||
{date && <p>{`${day} ${month} ${year}`}</p>}
|
{date && <p>{`${day} ${month} ${year}`}</p>}
|
||||||
</div>
|
</div>
|
||||||
|
@ -90,6 +90,7 @@ export default function SearchPage({ topics, shows }: SearchPageProps) {
|
|||||||
'Logos online publishing and blogging platform for writers and readers.'
|
'Logos online publishing and blogging platform for writers and readers.'
|
||||||
}
|
}
|
||||||
title={'Logos Press Engine'}
|
title={'Logos Press Engine'}
|
||||||
|
pagePath={`/search`}
|
||||||
/>
|
/>
|
||||||
<SearchBox
|
<SearchBox
|
||||||
tags={topics}
|
tags={topics}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user