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