Align user-product links and chart copy with id+slug URLs.
Support pathSlug in types/website helpers and note that product views include customer listings. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
c2ede07e73
commit
9ce93b0b48
@@ -4,6 +4,7 @@ export type WebsiteLinkKind = 'product' | 'storeItem' | 'blog' | 'portfolio' | '
|
||||
|
||||
export type WebsiteContentKind =
|
||||
| 'product'
|
||||
| 'userProduct'
|
||||
| 'blog'
|
||||
| 'portfolio'
|
||||
| 'video'
|
||||
@@ -61,8 +62,10 @@ export function buildWebsiteContentUrl(
|
||||
item: {
|
||||
id: string
|
||||
slug?: string | null
|
||||
pathSlug?: string | null
|
||||
title?: string | null
|
||||
titleFa?: string | null
|
||||
titleEn?: string | null
|
||||
nameFa?: string | null
|
||||
nameEn?: string | null
|
||||
},
|
||||
@@ -80,6 +83,19 @@ export function buildWebsiteContentUrl(
|
||||
)
|
||||
return `${origin}/products/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
|
||||
}
|
||||
case 'userProduct': {
|
||||
const pathSlug =
|
||||
item.pathSlug?.trim() ||
|
||||
slugifyForWebsitePath(
|
||||
item.titleFa?.trim() ||
|
||||
item.title?.trim() ||
|
||||
item.titleEn?.trim() ||
|
||||
item.nameEn?.trim() ||
|
||||
'',
|
||||
'user-product',
|
||||
)
|
||||
return `${origin}/user-products/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
|
||||
}
|
||||
case 'blog': {
|
||||
const slug = item.slug?.trim()
|
||||
return slug ? `${origin}/blog/${encodeURIComponent(slug)}` : ''
|
||||
|
||||
Reference in New Issue
Block a user