Generate Orchard CMS Autoroutes based on hierarchical menu

烂漫一生 提交于 2019-12-10 19:49:30

问题


I have a set of custom content type pages in Orchard that are set up in an advanced menu like so:

Title: Parent Page Position: 1

Title: Child Page Position: 1.1

Title: Grandchild Page Position: 1.1.1

Right now each has a URL that reflects the name (eg., /parent-page, /child-page, /grandchild-page).

How can I get the URLs for my custom content types to generate hierarchical urls (eg., /parent-page, /parent-page/child-page, /parent-page/child-page/grandchild-page) automatically?

-Carson


回答1:


If you have a token for the parent, you can do what taxonomies are doing for their default alias pattern. Which brings me to the objection I would have to the actual question. It should not be the navigation that models the structure of contents but rather the structure of the contents that is reflected in the menu. So I would start with a good taxonomy of the contents and generate navigation from that. Your URLs would be right immediately if you did that.



来源:https://stackoverflow.com/questions/9727931/generate-orchard-cms-autoroutes-based-on-hierarchical-menu

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