What's the recommended approach for hierarchical URLs in Orchard?

☆樱花仙子☆ 提交于 2019-12-12 15:38:41

问题


I'd like to have a hierarchical URL structure in my site. Something on these lines:

  • tutorials
    • javascript
      • jquery

There should be a page at each level (tutorials, tutorials/javascript and tutorials/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 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?

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.


回答1:


Here's an approach that seems to work without having to use taxonomies:

I added a Content Picker field called ParentPage to the Page content type and updated the Page's Autoroute default to

{Content.Fields.Page.ParentPage.Content.Path}/{Content.Slug}

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.



来源:https://stackoverflow.com/questions/13540933/whats-the-recommended-approach-for-hierarchical-urls-in-orchard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!