added base_url iamge
This commit is contained in:
@@ -8,16 +8,15 @@ import { BASE_URL } from '@/shared/config/api/URLs';
|
|||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
params: { locale: 'uz' | 'ru' };
|
params: { locale: 'uz' | 'ru' | 'en' };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||||
const { locale } = params;
|
const { locale } = await params; // Next.js 15 da params async
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await partner_api.getAbout();
|
const res = await partner_api.getAbout();
|
||||||
const data: AboutData = res.data;
|
const data: AboutData = res.data;
|
||||||
|
|
||||||
const banner = data.banner;
|
const banner = data.banner;
|
||||||
|
|
||||||
const title =
|
const title =
|
||||||
@@ -35,8 +34,10 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|||||||
: banner.description_en;
|
: banner.description_en;
|
||||||
|
|
||||||
const bannerUrl = banner.image
|
const bannerUrl = banner.image
|
||||||
? BASE_URL + banner.image
|
? `${BASE_URL}${banner.image}`
|
||||||
: '/logos/logo.png';
|
: '/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',
|
||||||
@@ -51,11 +52,11 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|||||||
{
|
{
|
||||||
url: bannerUrl,
|
url: bannerUrl,
|
||||||
width: 1200,
|
width: 1200,
|
||||||
height: 1200,
|
height: 630,
|
||||||
alt: title || 'Gastro Market',
|
alt: title || 'Gastro Market',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
locale: locale === 'uz' ? 'uz_UZ' : 'ru_RU',
|
locale: ogLocale,
|
||||||
type: 'website',
|
type: 'website',
|
||||||
},
|
},
|
||||||
twitter: {
|
twitter: {
|
||||||
@@ -75,11 +76,10 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Page component
|
// ✅ Page ham params olishi kerak
|
||||||
const page = async () => {
|
const AboutPage = async () => {
|
||||||
return (
|
return (
|
||||||
<div className="custom-container">
|
<div className="custom-container">
|
||||||
{/* Hero va Content ichida React Query ishlatilgan loading + dynamic data */}
|
|
||||||
<AboutHero />
|
<AboutHero />
|
||||||
<AboutContent />
|
<AboutContent />
|
||||||
<PartnershipForm />
|
<PartnershipForm />
|
||||||
@@ -87,4 +87,4 @@ const page = async () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default page;
|
export default AboutPage;
|
||||||
|
|||||||
Reference in New Issue
Block a user