Orchard 中分层 URL 的推荐方法是什么? [英] What's the recommended approach for hierarchical URLs in Orchard?
问题描述
我想在我的网站中使用分层 URL 结构.这些线路上的内容:
I'd like to have a hierarchical URL structure in my site. Something on these lines:
- 教程
- javascript
- jquery
每个级别都应该有一个页面(
tutorials
、tutorials/javascript
和tutorials/javascript/jquery
).显然,使用分类法可以帮助我以这种方式组织我的内容,但如何为这种情况生成自动路由 URL?There should be a page at each level (
tutorials
,tutorials/javascript
andtutorials/javascript/jquery
). Obviously, using Taxonomies would help me organize my content in this manner, but how do I get Autoroute URLs generated for this scenario?Bertrand Le Roy 在这个 SO 答案中发表了评论 关于使用分类术语作为页面,但它似乎仍然没有为我创建正确的 URL 结构.我错过了什么吗?是否需要配置或启用某些特定内容才能实现此目的?
Bertrand Le Roy made a comment on this SO answer about using taxonomy terms as pages but it still doesn't seem to create the right URL structure for me. Am I missing something? Is there something specific I need to configure or enable to make this happen?
我还有其他方法可以考虑吗?
Are there any other approaches I can look at?
我想将默认路由指定为 {Content.Fields.Page.TaxonomyName} 之类的东西.根据此错误报告,现在看来这不太可能.
I was thinking of specifying the default route as something like {Content.Fields.Page.TaxonomyName}. It appears that this isn't really possible right now according to this bug report.
推荐答案
以下是一种似乎无需使用分类法即可工作的方法:
Here's an approach that seems to work without having to use taxonomies:
我在
Page
内容类型中添加了一个名为ParentPage
的Content Picker
字段并更新了Page
的自动路由默认为I added a
Content Picker
field calledParentPage
to thePage
content type and updated thePage
's Autoroute default to{Content.Fields.Page.ParentPage.Content.Path}/{Content.Slug}
现在在每个页面中,我都可以选择父页面是什么,并且 URL 是按照我期望的方式构建的.从我记得使用 WordPress 的情况来看,我认为这与它允许您执行父页面操作的方式非常接近.
Now in each page I get to pick what the parent page is and the URL is constructed how I expect it. From what I remember of working with WordPress, I think this is pretty close to how it allows you to do this parent page thing, too.
这篇关于Orchard 中分层 URL 的推荐方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- javascript