fix: sitemap changed product from detail
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
import { ContactForm } from "@/components/ContactForm";
|
||||
import DetailInfo from "@/components/detailPage/detailInfo";
|
||||
import { getAllProducts } from "@/lib/api";
|
||||
import { Product } from "@/lib/products";
|
||||
import { generateSlug } from "@/lib/slug";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const products = await getAllProducts();
|
||||
|
||||
return products.map((product) => ({
|
||||
slug: generateSlug(product.name_uz),
|
||||
}));
|
||||
}
|
||||
|
||||
async function getProduct(slug: string): Promise<Product | undefined> {
|
||||
const products = await getAllProducts();
|
||||
console.log("slug: ", slug);
|
||||
|
||||
return products.find((product) => generateSlug(product.name_uz) === slug);
|
||||
}
|
||||
|
||||
export default async function Page({ params }: { params: { slug: string } }) {
|
||||
const product = await getProduct(params.slug);
|
||||
|
||||
if (!product) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<DetailInfo product={product} />
|
||||
<section id="contact">
|
||||
<ContactForm />
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -33,7 +33,7 @@ export default function sitemap(): MetadataRoute.Sitemap {
|
||||
];
|
||||
|
||||
const productPages = productSlugs.map((slug) => ({
|
||||
url: `${baseUrl}/detail/${slug}`,
|
||||
url: `${baseUrl}/product/${slug}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: "monthly" as const,
|
||||
priority: 0.8,
|
||||
|
||||
@@ -26,7 +26,7 @@ export function Navbar({ logoText = "FIRMA" }: NavbarProps) {
|
||||
|
||||
const navLinks: NavLink[] = [
|
||||
{ id: "about", labelKey: t.nav.about, href: "#about" },
|
||||
{ id: "products", labelKey: t.nav.products, href: "#products" },
|
||||
{ id: "products", labelKey: t.nav.products, href: "/product" },
|
||||
{ id: "faq", labelKey: t.nav.faq, href: "#faq" },
|
||||
{ id: "contact", labelKey: t.nav.contact, href: "#contact" },
|
||||
];
|
||||
@@ -64,16 +64,26 @@ export function Navbar({ logoText = "FIRMA" }: NavbarProps) {
|
||||
|
||||
{/* Desktop Menu */}
|
||||
<div className="hidden md:flex items-center gap-8">
|
||||
{navLinks.map((link) => (
|
||||
<motion.button
|
||||
key={link.id}
|
||||
whileHover={{ color: "#2563eb" }}
|
||||
onClick={() => handleScroll(link.href)}
|
||||
className="text-[#468965] hover:text-[#468965] transition-colors hover:cursor-pointer"
|
||||
>
|
||||
{link.labelKey}
|
||||
</motion.button>
|
||||
))}
|
||||
{navLinks.map((link) =>
|
||||
link.id === "products" ? (
|
||||
<Link
|
||||
key={link.id}
|
||||
href={link.href}
|
||||
className="text-[#468965] hover:text-[#468965] transition-colors hover:cursor-pointer"
|
||||
>
|
||||
{link.labelKey}
|
||||
</Link>
|
||||
) : (
|
||||
<motion.button
|
||||
key={link.id}
|
||||
whileHover={{ color: "#2563eb" }}
|
||||
onClick={() => handleScroll(link.href)}
|
||||
className="text-[#468965] hover:text-[#468965] transition-colors hover:cursor-pointer"
|
||||
>
|
||||
{link.labelKey}
|
||||
</motion.button>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Language & Mobile Menu */}
|
||||
|
||||
Reference in New Issue
Block a user