fix
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// app/[locale]/about/page.tsx
|
||||
import { partner_api } from '@/features/about/lib/api';
|
||||
import { AboutData } from '@/features/about/lib/type';
|
||||
import { AboutContent } from '@/features/about/ui/AboutContent';
|
||||
import { AboutHero } from '@/features/about/ui/AboutHero';
|
||||
import { PartnershipForm } from '@/features/about/ui/AboutPage';
|
||||
@@ -11,13 +10,19 @@ interface Props {
|
||||
params: { locale: 'uz' | 'ru' | 'en' };
|
||||
}
|
||||
|
||||
export const revalidate = 0;
|
||||
|
||||
function getImageUrl(image?: string | null): string {
|
||||
if (!image || image.length === 0) return '/placeholder.svg';
|
||||
return image.includes(BASE_URL) ? image : BASE_URL + image;
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { locale } = await params; // Next.js 15 da params async
|
||||
const { locale } = await params;
|
||||
|
||||
try {
|
||||
const res = await partner_api.getAbout();
|
||||
const data: AboutData = res.data;
|
||||
const banner = data.banner;
|
||||
const banner = res.data.banner;
|
||||
|
||||
const title =
|
||||
locale === 'uz'
|
||||
@@ -33,50 +38,40 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
? banner.description_ru
|
||||
: banner.description_en;
|
||||
|
||||
const bannerUrl = banner.image
|
||||
? `${BASE_URL}${banner.image}`
|
||||
: '/logos/logo.png';
|
||||
const ogLocale =
|
||||
locale === 'uz' ? 'uz_UZ' : locale === 'ru' ? 'ru_RU' : 'en_US';
|
||||
const imageUrl = getImageUrl(banner?.image);
|
||||
|
||||
return {
|
||||
title: title || 'Gastro Market',
|
||||
description:
|
||||
description || 'Gastro Market – gastronomiya va kulinariya olami',
|
||||
description: description || 'Gastro Market mahsulotlarini kashf eting',
|
||||
openGraph: {
|
||||
title: title || 'Gastro Market',
|
||||
description:
|
||||
description || 'Gastro Market – gastronomiya va kulinariya olami',
|
||||
siteName: 'GASTRO',
|
||||
description: description || 'Gastro Market mahsulotlarini kashf eting',
|
||||
type: 'website',
|
||||
images: [
|
||||
{
|
||||
url: bannerUrl,
|
||||
url: imageUrl,
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: title || 'Gastro Market',
|
||||
},
|
||||
],
|
||||
locale: ogLocale,
|
||||
type: 'website',
|
||||
},
|
||||
twitter: {
|
||||
card: 'summary_large_image',
|
||||
title: title || 'Gastro Market',
|
||||
description:
|
||||
description || 'Gastro Market – gastronomiya va kulinariya olami',
|
||||
images: [bannerUrl],
|
||||
description: description || 'Gastro Market mahsulotlarini kashf eting',
|
||||
images: [imageUrl],
|
||||
},
|
||||
};
|
||||
} catch (err) {
|
||||
console.error('About metadata error:', err);
|
||||
} catch (error) {
|
||||
console.error('About metadata error:', error);
|
||||
return {
|
||||
title: 'Gastro Market',
|
||||
description: 'Gastro Market – gastronomiya va kulinariya olami',
|
||||
description: 'Gastro Market mahsulotlarini kashf eting',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ Page ham params olishi kerak
|
||||
const AboutPage = async () => {
|
||||
return (
|
||||
<div className="custom-container">
|
||||
|
||||
Reference in New Issue
Block a user