Rocky_Mountain_Vending/app/food-and-beverage/traditional-options/page.tsx

101 lines
3.3 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 { DropdownPageShell } from "@/components/dropdown-page-shell"
import type { Metadata } from "next"
const WORDPRESS_SLUG = "traditional-vending"
export async function generateMetadata(): Promise<Metadata> {
const page = getPageBySlug(WORDPRESS_SLUG)
if (!page) {
return {
title: "Page Not Found | Rocky Mountain Vending",
}
}
return generateRegistryMetadata("traditionalOptions", {
date: page.date,
modified: page.modified,
image: page.images?.[0]?.localPath,
})
}
export default async function TraditionalOptionsPage() {
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("traditionalOptions", {
datePublished: page.date,
dateModified: page.modified || page.date,
})
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }}
/>
<DropdownPageShell
breadcrumbs={[
{ label: "Food & Beverage" },
{ label: "Traditional Options" },
]}
eyebrow="Food & Beverage"
title={page.title || "Traditional Vending Options"}
description={
page.seoDescription ||
page.excerpt ||
"See the traditional snack and beverage options Rocky Mountain Vending can stock, and how we shape a lineup around the people using the location."
}
content={content}
contentClassName="prose prose-lg max-w-none prose-headings:text-foreground prose-p:text-muted-foreground prose-a:text-foreground prose-a:underline prose-a:decoration-primary/35 prose-a:underline-offset-4 hover:prose-a:decoration-primary prose-strong:text-foreground"
cta={{
eyebrow: "Product Planning",
title: "Want a lineup that actually fits your location?",
description:
"We can help you mix traditional favorites, healthier options, drinks, and pricing tiers in a way that makes sense for your audience and traffic.",
actions: [
{ label: "Talk to Our Team", href: "/contact-us#contact-form" },
{
label: "View Healthy Options",
href: "/food-and-beverage/healthy-options",
variant: "outline",
},
],
}}
/>
</>
)
} catch (error) {
if (process.env.NODE_ENV === "development") {
console.error("Error rendering Traditional Options page:", error)
}
notFound()
}
}