import React from "react"; import type { Metadata } from "next"; import Link from "next/link"; import Breadcrumb from "@/app/components/reuseableUI/breadcrumb"; import Heading from "@/app/components/reuseableUI/heading"; import EditorRenderer from "@/app/components/richText/EditorRenderer"; import { fetchBlogBySlug } from "@/graphql/queries/getBlogs"; import { getStoreName } from "@/app/utils/branding"; import { generateBlogPostingSchema, generateBreadcrumbSchema, } from "@/lib/schema"; const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "http://localhost:3000"; const storeName = getStoreName(); const canonicalUrl = `${baseUrl.replace(/\/$/, "")}/site-map`; const ogImageUrl = `${baseUrl.replace(/\/$/, "")}/og-image.png`; export async function generateMetadata(): Promise { const post = await fetchBlogBySlug("site-map"); if (!post || !post.title) { const title = `Site Map | ${storeName}`; const description = `Explore the comprehensive site map of ${storeName} to easily navigate through all sections and find what you're looking for quickly.`; return { title, description, alternates: { canonical: canonicalUrl }, openGraph: { title, description, type: "website", url: canonicalUrl, siteName: storeName, images: [ { url: ogImageUrl, width: 1200, height: 630, alt: `${storeName} - Site Map`, }, ], }, twitter: { card: "summary_large_image", title, description, images: [ogImageUrl], }, }; } const title = `${post.title} | ${storeName}`; const description = post.title || `Explore the comprehensive site map of ${storeName} to easily navigate through all sections and find what you're looking for quickly.`; return { title, description, alternates: { canonical: canonicalUrl }, openGraph: { title, description, type: "article", url: canonicalUrl, siteName: storeName, images: [ { url: ogImageUrl, width: 1200, height: 630, alt: `${storeName} - Site Map`, }, ], }, twitter: { card: "summary_large_image", title, description, images: [ogImageUrl], }, }; } export default async function SiteMapPage() { const post = await fetchBlogBySlug("site-map"); if (!post || !post.title) { return (

Content Not Found

The requested site map could not be found.

← Back to Home
); } // Generate schema.org structured data const blogSchema = generateBlogPostingSchema( post.title, post.title, "/site-map", post.created || new Date().toISOString(), post.created || new Date().toISOString() ); const breadcrumbSchema = generateBreadcrumbSchema([ { name: "Home", url: "/" }, { name: post.title, url: "/site-map" }, ]); return (
{/* Schema.org structured data */}