Use Meshkee {id}/{fa-slug} detail URLs for products and blogs.

Resolve pages via by-id APIs, slugify Farsi titles for public paths, and redirect legacy slug-only URLs to the canonical form.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-22 23:52:45 +03:30
co-authored by Cursor
parent 24b5649abd
commit 0cb9aa57e2
14 changed files with 426 additions and 307 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ export function BlogCarousel({
key={post.slug}
className="w-[min(85vw,340px)] shrink-0 snap-start rounded-2xl border border-line bg-white p-3"
>
<Link href={`/blog/${post.slug}`} className="group block">
<Link href={blogHref({ id: post.slug, title: post.title })} className="group block">
<div className="overflow-hidden rounded-xl">
<Placeholder
src={post.image}
+5 -2
View File
@@ -6,7 +6,7 @@ import { useRouter } from "next/navigation";
import { Search } from "lucide-react";
import { Placeholder } from "@/components/Placeholder";
import { formatPrice } from "@/lib/format";
import { variantTitle, type StoreVariant } from "@/lib/store";
import { productHref, variantTitle, type StoreVariant } from "@/lib/store";
export function InstantSearch({ compact = false, className = "" }: { compact?: boolean; className?: string }) {
const router = useRouter();
@@ -88,7 +88,10 @@ export function InstantSearch({ compact = false, className = "" }: { compact?: b
return (
<li key={item.id}>
<Link
href={`/products/${encodeURIComponent(item.id)}`}
href={productHref(
item.productId || item.id,
item.productNameFa || item.productTitle || item.label,
)}
className="flex items-center gap-3 px-3 py-2 hover:bg-paper"
onClick={() => setOpen(false)}
>
+2 -1
View File
@@ -3,9 +3,10 @@ import { ArrowUpLeft } from "lucide-react";
import { Placeholder } from "@/components/Placeholder";
import { faDigits, formatPrice } from "@/lib/format";
import type { Product } from "@/lib/data";
import { productHref } from "@/lib/store";
export function ProductCard({ product }: { product: Product }) {
const href = product.href ?? `/products/${encodeURIComponent(product.id)}`;
const href = product.href ?? productHref(product.id, product.title);
return (
<article className="group flex h-full flex-col rounded-2xl border border-line bg-white p-3">