chore: clean up scratch files and apply remaining updates

This commit is contained in:
AyrisAI
2026-07-13 14:17:57 +03:00
parent 9866413511
commit 53cbee0841
28 changed files with 986 additions and 284 deletions
+59 -4
View File
@@ -7,6 +7,8 @@ import { Link } from '@/i18n/routing'
import { Phone, Globe, MapPin, Clock, Star, MessageSquare, Share2 } from 'lucide-react'
import SaveButton from './SaveButton'
import DetailTracker from './DetailTracker'
import type { Metadata } from 'next'
import { SITE_URL } from '@/lib/seo'
interface DetailPageProps {
params: Promise<{ locale: string; category: string; slug: string }>
@@ -14,14 +16,32 @@ interface DetailPageProps {
export const dynamic = 'force-dynamic'
export async function generateMetadata({ params }: DetailPageProps) {
const { slug } = await params
export async function generateMetadata({ params }: DetailPageProps): Promise<Metadata> {
const { locale, slug } = await params
const listing = await mockDb.getListingBySlug(slug)
if (!listing) return {}
const name = locale === 'ru' ? listing.nameRu : locale === 'en' ? listing.nameEn : listing.nameTr
const description = locale === 'ru' ? listing.descriptionRu : locale === 'en' ? listing.descriptionEn : listing.descriptionTr
const title = `${name} — Marmaris Local`
const image = listing.images?.[0]?.url
return {
title: `${listing.nameTr} — Marmaris Local`,
description: listing.descriptionTr
title,
description,
openGraph: {
title,
description,
url: `${SITE_URL}/${locale}/${listing.category?.slug || 'isletme'}/${listing.slug}`,
siteName: 'Marmaris Local',
type: 'website',
...(image ? { images: [{ url: image }] } : {}),
},
twitter: {
card: 'summary_large_image',
title,
description,
},
}
}
@@ -86,8 +106,43 @@ export default async function ListingDetailPage({ params }: DetailPageProps) {
return `https://wa.me/?text=${text}`
}
// schema.org LocalBusiness structured data
const schemaTypeByCategory: Record<string, string> = {
restoran: 'Restaurant',
apart: 'LodgingBusiness',
isletme: 'LocalBusiness',
}
const jsonLd = {
'@context': 'https://schema.org',
'@type': schemaTypeByCategory[categorySlug] || 'LocalBusiness',
name,
description,
image: listing.images?.map(img => img.url) || undefined,
url: `https://marmarislocal.com/${locale}/${categorySlug}/${listing.slug}`,
address: {
'@type': 'PostalAddress',
streetAddress: listing.address,
addressLocality: 'Marmaris',
addressCountry: 'TR',
},
...(listing.latitude && listing.longitude
? { geo: { '@type': 'GeoCoordinates', latitude: listing.latitude, longitude: listing.longitude } }
: {}),
...(listing.phone ? { telephone: listing.phone } : {}),
...(listing.website ? { sameAs: [listing.website] } : {}),
priceRange: priceSymbols || undefined,
...(listing.openingHours && (listing.openingHours as any).all
? { openingHours: (listing.openingHours as any).all }
: {}),
}
return (
<div className="flex-1 flex flex-col min-h-screen bg-stone text-ink">
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>
<DetailTracker listingId={listing.id} />
<main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-10 flex-1 space-y-10">