From 75b3674e20d3080acdf23da8d8d6fb7575920160 Mon Sep 17 00:00:00 2001 From: Samandar Turgunboyev Date: Thu, 26 Feb 2026 12:53:29 +0500 Subject: [PATCH] fix --- src/app/[locale]/about/page.tsx | 43 +++++++++++++++------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/src/app/[locale]/about/page.tsx b/src/app/[locale]/about/page.tsx index a8a87db..46ff8fb 100644 --- a/src/app/[locale]/about/page.tsx +++ b/src/app/[locale]/about/page.tsx @@ -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 { - 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 { ? 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 (