Skip to content

Commit

Permalink
πŸ† β˜• πŸ₯‘ set alternates meta for better SEO
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-20 committed Feb 2, 2025
1 parent b205dcf commit edbe78c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/shared/lib/metadataGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,23 @@ export const metadataHelper = ({ title: rawTitle, description, locale, ogp }: Op
}[locale];
const title = rawTitle ? `${rawTitle} - ${appName}` : appName;

const alternates = i18nConfig.locales
.filter((lang) => lang !== locale)
.reduce(
(acc, lang) => {
acc[lang] = `${appBaseUrl}/${lang}`;
return acc;
},
{} as Record<Locale, string>,
);

return {
title,
description,
metadataBase: new URL(appBaseUrl),
alternates: {
languages: alternates,
},
openGraph: {
title,
description,
Expand Down

0 comments on commit edbe78c

Please sign in to comment.