78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
import { notFound } from "next/navigation"
|
|
import { loadImageMapping } from "@/lib/wordpress-content"
|
|
import { generateRegistryMetadata, generateRegistryStructuredData } from "@/lib/seo"
|
|
import { getPageBySlug } from "@/lib/wordpress-data-loader"
|
|
import { cleanWordPressContent } from "@/lib/clean-wordPress-content"
|
|
import { WhoWeServePage } from "@/components/who-we-serve-page"
|
|
import type { Metadata } from "next"
|
|
|
|
const WORDPRESS_SLUG =
|
|
"enhancing-auto-repair-facilities-with-convenient-vending-solutions"
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const page = getPageBySlug(WORDPRESS_SLUG)
|
|
|
|
if (!page) {
|
|
return {
|
|
title: "Page Not Found | Rocky Mountain Vending",
|
|
}
|
|
}
|
|
|
|
return generateRegistryMetadata("autoRepair", {
|
|
date: page.date,
|
|
modified: page.modified,
|
|
image: page.images?.[0]?.localPath,
|
|
})
|
|
}
|
|
|
|
export default async function AutoRepairPage() {
|
|
try {
|
|
const page = getPageBySlug(WORDPRESS_SLUG)
|
|
|
|
if (!page) {
|
|
notFound()
|
|
}
|
|
|
|
let imageMapping: any = {}
|
|
try {
|
|
imageMapping = loadImageMapping()
|
|
} catch (e) {
|
|
imageMapping = {}
|
|
}
|
|
|
|
const content = page.content ? (
|
|
<div className="max-w-none">
|
|
{cleanWordPressContent(String(page.content), {
|
|
imageMapping,
|
|
pageTitle: page.title,
|
|
})}
|
|
</div>
|
|
) : (
|
|
<p className="text-muted-foreground">No content available.</p>
|
|
)
|
|
|
|
const structuredData = generateRegistryStructuredData("autoRepair", {
|
|
datePublished: page.date,
|
|
dateModified: page.modified || page.date,
|
|
})
|
|
|
|
return (
|
|
<>
|
|
<script
|
|
type="application/ld+json"
|
|
dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }}
|
|
/>
|
|
<WhoWeServePage
|
|
title={page.title || "Auto Repair Vending Solutions"}
|
|
description={page.seoDescription || page.excerpt || undefined}
|
|
content={content}
|
|
/>
|
|
</>
|
|
)
|
|
} catch (error) {
|
|
if (process.env.NODE_ENV === "development") {
|
|
console.error("Error rendering Auto Repair page:", error)
|
|
}
|
|
notFound()
|
|
}
|
|
}
|