关于似乎只有可以更改那些路线,这些路由是将产品,类别和品牌页面路由的路由。他们声明“内容页面在CMS中具有可配置的URL”和“为了添加新路由,您只需在CMS中添加一个新的内容页面,然后给它一个页面标签。但是,Spartacus(例如“订单”)提供的内容页面已经配置了。有问题。
我的当前帐户页面在路由“/帐户”下列出,但订单路由指向“/my-account/orders”。有没有办法覆盖来自Spartacus CMS页面的那些路线?
我已经使用自定义路由创建了一个新的内容页面:
;;orders ;/account/orders ;Orders History ;AccountPageTemplate
并尝试在我的前端中为此添加自定义路由配置:
orders: {
paths: ['account/orders'],
}
这
{
data: {
pageLabel: 'orders',
cxRoute: 'orders'
},
component: CmsPageComponent,
canActivate: [CmsPageGuard],
path: null
}
是行不通的。它只是路由“/”,因为它找不到合适的映射。
我希望你们中的一些人有同样的问题,可以为此提供简单的解决方案。如果您需要更多信息或代码,请告诉我。 :)
Reading through the docs of spartacus, regarding the customization of routing links it seems like it is only possible to change those routes, that are routing to product, category, and brand pages. They state 'Content pages have a configurable URL in the CMS' and 'To add a new route, you simply add a new Content page in the CMS, and give it a page label'. However, there are content pages provided by spartacus (e.g. 'orders'), that already have a configured route. Here comes the problem.
My current account page is listed under the route '/account', but the orders-route points at '/my-account/orders'. Is there a way to override those routes coming from spartacus CMS pages?
I already created a new content page with my customized route:
;;orders ;/account/orders ;Orders History ;AccountPageTemplate
And tried to simply add a custom routing config for that in my frontend:
orders: {
paths: ['account/orders'],
}
and
{
data: {
pageLabel: 'orders',
cxRoute: 'orders'
},
component: CmsPageComponent,
canActivate: [CmsPageGuard],
path: null
}
This doesn't work. It just routes to '/' since it cant find a fitting mapping.
I hope some of you had a same problem and can provide an easy solution for this. If you need any more information or code, let me know. :)
发布评论