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) => ({
|
const productPages = productSlugs.map((slug) => ({
|
||||||
url: `${baseUrl}/detail/${slug}`,
|
url: `${baseUrl}/product/${slug}`,
|
||||||
lastModified: new Date(),
|
lastModified: new Date(),
|
||||||
changeFrequency: "monthly" as const,
|
changeFrequency: "monthly" as const,
|
||||||
priority: 0.8,
|
priority: 0.8,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export function Navbar({ logoText = "FIRMA" }: NavbarProps) {
|
|||||||
|
|
||||||
const navLinks: NavLink[] = [
|
const navLinks: NavLink[] = [
|
||||||
{ id: "about", labelKey: t.nav.about, href: "#about" },
|
{ 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: "faq", labelKey: t.nav.faq, href: "#faq" },
|
||||||
{ id: "contact", labelKey: t.nav.contact, href: "#contact" },
|
{ id: "contact", labelKey: t.nav.contact, href: "#contact" },
|
||||||
];
|
];
|
||||||
@@ -64,7 +64,16 @@ export function Navbar({ logoText = "FIRMA" }: NavbarProps) {
|
|||||||
|
|
||||||
{/* Desktop Menu */}
|
{/* Desktop Menu */}
|
||||||
<div className="hidden md:flex items-center gap-8">
|
<div className="hidden md:flex items-center gap-8">
|
||||||
{navLinks.map((link) => (
|
{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
|
<motion.button
|
||||||
key={link.id}
|
key={link.id}
|
||||||
whileHover={{ color: "#2563eb" }}
|
whileHover={{ color: "#2563eb" }}
|
||||||
@@ -73,7 +82,8 @@ export function Navbar({ logoText = "FIRMA" }: NavbarProps) {
|
|||||||
>
|
>
|
||||||
{link.labelKey}
|
{link.labelKey}
|
||||||
</motion.button>
|
</motion.button>
|
||||||
))}
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Language & Mobile Menu */}
|
{/* Language & Mobile Menu */}
|
||||||
|
|||||||
Reference in New Issue
Block a user