Add Torob tags, Meshkee SEO routes, and updated static-image slots.
Product pages emit crawler-readable meta, public URLs use id plus Farsi slugs, and the homepage catalog matches the dashboard slot keys. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
f42c30a4b7
commit
c84147e765
+26
@@ -0,0 +1,26 @@
|
||||
import { getCategories, type ApiCategory } from "./api";
|
||||
import { parentCategories } from "./data";
|
||||
import { categoryHref } from "./paths";
|
||||
|
||||
export type MenuCategory = {
|
||||
name: string;
|
||||
href: string;
|
||||
children: { name: string; href: string }[];
|
||||
};
|
||||
|
||||
function hrefForSlug(categories: ApiCategory[], slug: string) {
|
||||
const match = categories.find((category) => category.slug === slug);
|
||||
return match ? categoryHref(match) : `/products/${slug}`;
|
||||
}
|
||||
|
||||
export async function getMenuCategories(): Promise<MenuCategory[]> {
|
||||
const categories = await getCategories();
|
||||
return parentCategories.map((parent) => ({
|
||||
name: parent.name,
|
||||
href: hrefForSlug(categories, parent.slug),
|
||||
children: parent.children.map((child) => ({
|
||||
name: child.name,
|
||||
href: hrefForSlug(categories, child.slug),
|
||||
})),
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user