Rocky_Mountain_Vending/app/warehouses/page.tsx
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

95 lines
2.8 KiB
TypeScript

import { notFound } from 'next/navigation';
import { loadImageMapping } from '@/lib/wordpress-content';
import { generateSEOMetadata, generateStructuredData } 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 = 'streamlining-snack-and-beverage-access-in-warehouse-environments';
export async function generateMetadata(): Promise<Metadata> {
const page = getPageBySlug(WORDPRESS_SLUG);
if (!page) {
return {
title: 'Page Not Found | Rocky Mountain Vending',
};
}
return generateSEOMetadata({
title: page.title || 'Warehouse Vending Solutions',
description: page.seoDescription || page.excerpt || '',
excerpt: page.excerpt,
date: page.date,
modified: page.modified,
image: page.images?.[0]?.localPath,
});
}
export default async function WarehousesPage() {
try {
const page = getPageBySlug(WORDPRESS_SLUG);
if (!page) {
notFound();
}
// Load image mapping (optional, won't break if it fails)
let imageMapping: any = {};
try {
imageMapping = loadImageMapping();
} catch (e) {
imageMapping = {};
}
// Clean and render WordPress content as styled React components
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>
);
// Generate structured data
let structuredData;
try {
structuredData = generateStructuredData({
title: page.title || 'Warehouse Vending Solutions',
description: page.seoDescription || page.excerpt || '',
url: page.link || page.urlPath || `https://rockymountainvending.com/warehouses/`,
datePublished: page.date,
dateModified: page.modified || page.date,
type: 'WebPage',
});
} catch (e) {
structuredData = {
'@context': 'https://schema.org',
'@type': 'WebPage',
headline: page.title || 'Warehouse Vending Solutions',
description: page.seoDescription || '',
url: `https://rockymountainvending.com/warehouses/`,
};
}
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }}
/>
<WhoWeServePage title={page.title || 'Warehouse Vending Solutions'} content={content} />
</>
);
} catch (error) {
if (process.env.NODE_ENV === 'development') {
console.error('Error rendering Warehouses page:', error);
}
notFound();
}
}