Skip to content

Commit

Permalink
refactor(seo): fallbackSeo → defaultSeo
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Sep 16, 2024
1 parent f1fa62e commit 5fb97a1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/seo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ export async function fetchCompanyInfo(): Promise<CompanyInfo | null> {
export async function generateMetadataFromSeo(
seo: SeoData | null,
): Promise<Metadata> {
const { data: fallbackSeo } = await loadQuery<DefaultSeo | null>(
const { data: defaultSeo } = await loadQuery<DefaultSeo | null>(
DEFAULT_SEO_QUERY,
);
const companyInfo = await fetchCompanyInfo();

const title =
seo?.title ||
fallbackSeo?.seo?.seoTitle ||
defaultSeo?.seo?.seoTitle ||
companyInfo?.siteMetadata?.siteName ||
"Variant";
const description = seo?.description || fallbackSeo?.seo?.seoDescription;
const description = seo?.description || defaultSeo?.seo?.seoDescription;
const keywords = seo?.keywords || "";

const favicon = companyInfo?.brandAssets?.favicon;
Expand All @@ -109,7 +109,7 @@ export async function generateMetadataFromSeo(
title: title,
...(description ? { description: description } : {}),
})}`;
const sanityImageUrl = seo?.imageUrl || fallbackSeo?.seo?.seoImageUrl;
const sanityImageUrl = seo?.imageUrl || defaultSeo?.seo?.seoImageUrl;
const sanityImageParams = `?${new URLSearchParams({
w: OPEN_GRAPH_IMAGE_DIMENSIONS.width.toString(),
h: OPEN_GRAPH_IMAGE_DIMENSIONS.height.toString(),
Expand Down

0 comments on commit 5fb97a1

Please sign in to comment.