如何在SAP Spartacus中覆盖CMS驱动的路线?

发布于 2025-02-10 06:34:08 字数 923 浏览 0 评论 0 原文

关于似乎只有可以更改那些路线,这些路由是将产品,类别和品牌页面路由的路由。他们声明“内容页面在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. :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文