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:
co-authored by
Cursor
parent
4c3bf8324e
commit
8f0b4cef85
@@ -24,8 +24,8 @@ export const WEBSITE_LINK_KINDS: WebsiteLinkKind[] = [
|
|||||||
export const WEBSITE_LINK_KIND_PATH: Record<WebsiteLinkKind, string> = {
|
export const WEBSITE_LINK_KIND_PATH: Record<WebsiteLinkKind, string> = {
|
||||||
product: '/products',
|
product: '/products',
|
||||||
storeItem: '/store-items',
|
storeItem: '/store-items',
|
||||||
blog: '/blogs',
|
blog: '/blog',
|
||||||
portfolio: '/portfolios',
|
portfolio: '/portfolio',
|
||||||
video: '/videos',
|
video: '/videos',
|
||||||
workshop: '/workshops',
|
workshop: '/workshops',
|
||||||
}
|
}
|
||||||
@@ -81,15 +81,12 @@ export function buildWebsiteContentUrl(
|
|||||||
return `${origin}/products/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
|
return `${origin}/products/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
|
||||||
}
|
}
|
||||||
case 'blog': {
|
case 'blog': {
|
||||||
const pathSlug = slugifyForWebsitePath(item.title?.trim() || '', 'blog')
|
const slug = item.slug?.trim()
|
||||||
return `${origin}/blog/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
|
return slug ? `${origin}/blog/${encodeURIComponent(slug)}` : ''
|
||||||
}
|
}
|
||||||
case 'portfolio': {
|
case 'portfolio': {
|
||||||
const pathSlug = slugifyForWebsitePath(
|
const slug = item.slug?.trim()
|
||||||
item.titleFa?.trim() || item.title?.trim() || '',
|
return slug ? `${origin}/portfolio/${encodeURIComponent(slug)}` : ''
|
||||||
'portfolio',
|
|
||||||
)
|
|
||||||
return `${origin}/portfolios/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
|
|
||||||
}
|
}
|
||||||
case 'video': {
|
case 'video': {
|
||||||
const slug = item.slug?.trim()
|
const slug = item.slug?.trim()
|
||||||
@@ -97,7 +94,7 @@ export function buildWebsiteContentUrl(
|
|||||||
}
|
}
|
||||||
case 'instruction': {
|
case 'instruction': {
|
||||||
const slug = item.slug?.trim()
|
const slug = item.slug?.trim()
|
||||||
return slug ? `${origin}/instructions/${encodeURIComponent(slug)}` : ''
|
return slug ? `${origin}/instruction/${encodeURIComponent(slug)}` : ''
|
||||||
}
|
}
|
||||||
case 'workshop': {
|
case 'workshop': {
|
||||||
const slug = item.slug?.trim()
|
const slug = item.slug?.trim()
|
||||||
|
|||||||
Reference in New Issue
Block a user