diff --git a/app/[locale]/apps/categories/[catetgoryName]/page.tsx b/app/[locale]/apps/categories/[catetgoryName]/page.tsx index b3f72ad03b8..d45c67eae6f 100644 --- a/app/[locale]/apps/categories/[catetgoryName]/page.tsx +++ b/app/[locale]/apps/categories/[catetgoryName]/page.tsx @@ -149,7 +149,7 @@ const Page = async (props: { Ethereum.org - + / @@ -157,7 +157,7 @@ const Page = async (props: { {t("page-apps-all-apps")} - + / @@ -223,35 +223,45 @@ export async function generateMetadata(props: { }) { const params = await props.params const { locale, catetgoryName } = params - const t = await getTranslations("page-apps") - // Normalize slug to lowercase - const normalizedSlug = catetgoryName.toLowerCase() + try { + const t = await getTranslations("page-apps") - // Find category by matching the slug - const categoryEntry = Object.entries(appsCategories).find( - ([, categoryData]) => categoryData.slug === normalizedSlug - ) + // Normalize slug to lowercase + const normalizedSlug = catetgoryName.toLowerCase() - if (!categoryEntry) { - notFound() - } + // Find category by matching the slug + const categoryEntry = Object.entries(appsCategories).find( + ([, categoryData]) => categoryData.slug === normalizedSlug + ) - const [categoryEnum, category] = categoryEntry + if (!categoryEntry) { + throw new Error(`App category not found: ${catetgoryName}`) + } - if (!isValidCategory(categoryEnum)) { - notFound() - } + const [categoryEnum, category] = categoryEntry - const title = t(category.metaTitle) - const description = t(category.metaDescription) + if (!isValidCategory(categoryEnum)) { + throw new Error(`Invalid app category enum: ${categoryEnum}`) + } - return await getMetadata({ - locale, - slug: ["apps", "categories", normalizedSlug], - title, - description, - }) + const title = t(category.metaTitle) + const description = t(category.metaDescription) + + return await getMetadata({ + locale, + slug: ["apps", "categories", normalizedSlug], + title, + description, + }) + } catch { + const t = await getTranslations("common") + + return { + title: t("page-not-found"), + description: t("page-not-found-description"), + } + } } export default Page diff --git a/app/[locale]/developers/tools/[category]/page.tsx b/app/[locale]/developers/tools/[category]/page.tsx index 6b662021e7b..2f023144784 100644 --- a/app/[locale]/developers/tools/[category]/page.tsx +++ b/app/[locale]/developers/tools/[category]/page.tsx @@ -117,7 +117,7 @@ const Page = async (props: { {t("page-developers-tools-categories-title-other")} - + {DEV_TOOL_CATEGORIES.filter(({ slug }) => slug !== category).map( ({ slug, Icon }) => (