Skip to content

Commit

Permalink
Simplify metadata generation in PictureGalleries page
Browse files Browse the repository at this point in the history
Replace manual translation calls with _getPage method to streamline SEO data retrieval. This reduces code complexity and ensures consistent metadata generation across different languages.
  • Loading branch information
leolabdev committed Aug 30, 2024
1 parent 9198461 commit 133d3e3
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions frontend-next-migration/src/app/[lng]/picture-galleries/page.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
import {default as PictureGalleriesPage } from "@/preparedPages/PictureGalleryPages";
import {Metadata} from "next";
import {useServerTranslation} from "@/shared/i18n";


import {default as PictureGalleriesPage } from "@/preparedPages/PictureGalleryPages";
import {_getPage} from "./_getPage";

type Props = {
params: { lng: string }
}


export async function generateMetadata({ params }: Props): Promise<Metadata> {

const { t } = await useServerTranslation(params.lng, 'picture-galleries');

return {
title: t("head-title"),
description: t("head-description"),
keywords: t("head-keywords"),
}
return await _getPage(params.lng).then(r => r.seo);
}

export default async function PictureGalleries({ params }: Props) {

const { t } = await useServerTranslation(params.lng, 'picture-galleries');
const {page} = await _getPage(params.lng);

return (
<>
<PictureGalleriesPage
title={t('picture-galleries')}
{...page}
/>
</>
)
Expand Down

0 comments on commit 133d3e3

Please sign in to comment.