Autoroute (Orchardcore.autoroute)
This module allows you to specify a custom URL (permanent link permalink) for the content item.
Autoroute part
Attaches this section to the content type to specify a custom URL for the content item.
Then, go to the definition of the content type and edit the Autoroute part:
- Use the liquid expression to enter pattern, which represents the generated slug.
An example of the content with Titlepart will use it to generate slug:
{{ContentItem| Display_text| Slugify}}
Examples of content with Listpart and Titlepart (ig:blogpost nested in blogs) will generate slug using containers and headers:
{{ContentItem| Container| Display_text| Slugify}}/{{ ContentItem| Display_text| Slugify}}'
- Select Allow custom Path if you want to be able to enter custom paths when editing content items.
- If you want to be able to set the content item as the home page, check the ' Show homepage options '
Autoroute Alias
As long as you can retrieve content from an alias, you can retrieve the content item with autoroute through the URL (see the example below). This syntax is slug:<URL>
, e.g. slug:my-blog/my-blog-post
Liquid
When autoroute is enabled, you can retrieve content by URL in liquid view and templates:
{%assignmy_content=content["slug: my-blog/my-blog-post"]%}
Or
{%assignmy_content= content.slug["my-blog/my-blog-post"]%}
Orchard Core Document translation (v) automatic routing Autoroute (Orchardcore.autoroute)