feat(cms): improve admin content editing
This commit is contained in:
parent
12d31f5468
commit
a284bbc188
26 changed files with 362 additions and 147 deletions
22
app/seo.ts
22
app/seo.ts
|
|
@ -60,28 +60,32 @@ export function createMetadata(title: string, description: string, path = "/"):
|
|||
};
|
||||
}
|
||||
|
||||
export function createContentMetadata(seo: SeoContent): Metadata {
|
||||
const path = seo.canonicalUrl || "/";
|
||||
export function createContentMetadata(seo: SeoContent, fallbackSeo?: SeoContent): Metadata {
|
||||
const resolvedSeo = {
|
||||
...fallbackSeo,
|
||||
...Object.fromEntries(Object.entries(seo).filter(([, value]) => value.trim() !== "")),
|
||||
} as SeoContent;
|
||||
const path = resolvedSeo.canonicalUrl || "/";
|
||||
const url = new URL(path, siteUrl).toString();
|
||||
const title = seo.metaTitle || siteName;
|
||||
const description = seo.metaDescription || defaultTitle;
|
||||
const title = resolvedSeo.metaTitle || siteName;
|
||||
const description = resolvedSeo.metaDescription || defaultTitle;
|
||||
|
||||
return {
|
||||
...createMetadata(title, description, path),
|
||||
keywords: seo.keywords ? seo.keywords.split(",").map((keyword) => keyword.trim()).filter(Boolean) : keywords,
|
||||
keywords: resolvedSeo.keywords ? resolvedSeo.keywords.split(",").map((keyword) => keyword.trim()).filter(Boolean) : keywords,
|
||||
openGraph: {
|
||||
type: "website",
|
||||
locale: "de_DE",
|
||||
url,
|
||||
siteName,
|
||||
title: seo.openGraphTitle || title,
|
||||
description: seo.openGraphDescription || description,
|
||||
title: resolvedSeo.openGraphTitle || title,
|
||||
description: resolvedSeo.openGraphDescription || description,
|
||||
images: [
|
||||
{
|
||||
url: seo.socialImage || "/funktechnik_schubert_logo.jpg",
|
||||
url: resolvedSeo.socialImage || "/funktechnik_schubert_logo.jpg",
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: seo.openGraphTitle || title,
|
||||
alt: resolvedSeo.openGraphTitle || title,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue