Fix open-on-website links for blog, portfolio, and instruction.

Match live storefront paths: /blog/{slug}, /portfolio/{slug}, /instruction/{slug}.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-08 14:51:14 +03:30
co-authored by Cursor
parent 4c3bf8324e
commit 8f0b4cef85
+7 -10
View File
@@ -24,8 +24,8 @@ export const WEBSITE_LINK_KINDS: WebsiteLinkKind[] = [
export const WEBSITE_LINK_KIND_PATH: Record<WebsiteLinkKind, string> = {
product: '/products',
storeItem: '/store-items',
blog: '/blogs',
portfolio: '/portfolios',
blog: '/blog',
portfolio: '/portfolio',
video: '/videos',
workshop: '/workshops',
}
@@ -81,15 +81,12 @@ export function buildWebsiteContentUrl(
return `${origin}/products/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
}
case 'blog': {
const pathSlug = slugifyForWebsitePath(item.title?.trim() || '', 'blog')
return `${origin}/blog/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
const slug = item.slug?.trim()
return slug ? `${origin}/blog/${encodeURIComponent(slug)}` : ''
}
case 'portfolio': {
const pathSlug = slugifyForWebsitePath(
item.titleFa?.trim() || item.title?.trim() || '',
'portfolio',
)
return `${origin}/portfolios/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
const slug = item.slug?.trim()
return slug ? `${origin}/portfolio/${encodeURIComponent(slug)}` : ''
}
case 'video': {
const slug = item.slug?.trim()
@@ -97,7 +94,7 @@ export function buildWebsiteContentUrl(
}
case 'instruction': {
const slug = item.slug?.trim()
return slug ? `${origin}/instructions/${encodeURIComponent(slug)}` : ''
return slug ? `${origin}/instruction/${encodeURIComponent(slug)}` : ''
}
case 'workshop': {
const slug = item.slug?.trim()