我刚刚安装了 Bolt CMS 并设法为我的页面编辑了路由,所以路由/myPage
不是/page/myPage
.
现在我想做一些类似的事情来列出类别条目。目前要显示类别中的所有条目,路线看起来像/categories/myCategory
。是否可以更改路线,所以路线将只有/myCategory
?
根据 app/config/routing.yml 文档,您可以执行类似的操作。
categories:
path: /{slug}
defaults: { _controller: 'Bolt\Controllers\Frontend::taxonomy' }
requirements:
taxonomytype: 'categories'
确保这不会覆盖您的页面规则。
有关更多信息,您可以查看有关 Bolt Routing 的文档https://docs.bolt.cm/templates-routes#routing