This package allows you to create custom URLS and also change dynamically the template used to render any content node.
New configuration option to choose which examine index should be used by the routing engine.
New configuration options regarding the caching (time in cache, priority, ...)
Install the package through the backoffice like any other Umbraco package.
The installer will add new dasboard called "Routing" in the developer section of your backoffice
There are two ways to configure the routes :
By using the "Router" dasboard (in the developer section)
By editing manually the config file: ~/config/routing.config
Route parameters:
Url Segments [MANDATORY]
It can contain any number of url segments.
This parameter cannot be left empty. If it is empty no error will be displayed, but the route will be ignored by the routing engine.
Enabled [OPTIONAL]
Whether the routing engine should process the route.
Document Type Alias [OPTIONAL]
The routing engine will look up only for content nodes that match this Document Type
If this parameter is left empty then the engine will look up for any content type. If a property name is setup (see below), then only the content types that contains a property with the specified name will be searched.
Property Alias [OPTIONAL]
The routing engine will use the data contained in this property to compare it with the last segment of the request's url
If this parameter is left empty then the routing engine will display the content node specified in the Fallback NodeId parameter. If the Fallback NodeId parameter is also empty, then this route will be ignored.
There isn't any restriction regarding the property's datatype. That means that a property specified could contain JSON data for example.
Template [OPTIONAL]
Force Template [OPTIONAL]
Use the template specified below to display the content node
This parameter could contain an Umbraco template alias or the full path to the template. i.e. ~/views/home/homepage.cshtml
If this parameter is left empty then nothing is going to change and the default template assigned through the Umbraco backoffice will be used.
If the ForceTemplate parameter is true and this property is not empty then this template will be used to display the content node, even if there is already a template assigned.
If the ForceTemplate parameter is false then this template will be used only in the case that the content node doesn't have any template assigned.
Fallback NodeId [OPTIONAL]
If no content node was found with the previous parameters then it will display the content node specified (could be any document type and not necessarily the one defined in the DocumentTypeAlias parameter)
If this parameter is left empty then no fallback content will be displayed. That means that if the routing engine doesn't found any content node with this route then it will continue with the following route defined in the config file (if there is any).
Description [OPTIONAL]
This parameter is ignored by the routing engine.
<?xml version="1.0" encoding="utf-8"?><Routes> <Route UrlSegments="/news/new-version-available/" Enabled="true" DocumentTypeAlias="" PropertyAlias="" Template="" ForceTemplate="false" FallbackNodeId="1380" Description="" /> <Route UrlSegments="/news/you-should-update-asap/" Enabled="true" DocumentTypeAlias="" PropertyAlias="" Template="" ForceTemplate="false" FallbackNodeId="1381" Description="" /> <Route UrlSegments="/contact/" Enabled="true" DocumentTypeAlias="" PropertyAlias="" Template="" ForceTemplate="false" FallbackNodeId="1120" Description="" /></Routes>
This example is a mapping of urls to content nodes.
<?xml version="1.0" encoding="utf-8"?><Routes> <Route UrlSegments="/news/international/" Enabled="true" DocumentTypeAlias="newsInternational" PropertyAlias="name" Template="" ForceTemplate="false" FallbackNodeId="1260" Description="" /> <Route UrlSegments="/news/national/" Enabled="true" DocumentTypeAlias="newsNational" PropertyAlias="name" Template="" ForceTemplate="false" FallbackNodeId="1264" Description="" /></Routes>
http://www.mydomain.com/news/international/this-is-a-news/ => Any content node which name matches "this is a news" and its content type is "newsInternational" will be displayed
http://www.mydomain.com/news/international/ => The content node which id is 1260 will be displayed
http://www.mydomain.com/news/international2/ => The routing engine will proceed with the second route since this Url doesn't match with the first rule. The second route doesn't match neither. The default Umbraco routing engine will be used to try to find a content.
http://www.mydomain.com/news/national/this-is-a-news/ => Any content node which name matches "this is a news" and its content type is "national" will be displayed
<?xml version="1.0" encoding="utf-8"?><Routes> <Route UrlSegments="/news/" Enabled="true" DocumentTypeAlias="newsInternational" PropertyAlias="newsTitle" Template="" ForceTemplate="false" FallbackNodeId="" Description="" /> <Route UrlSegments="/news/" Enabled="true" DocumentTypeAlias="newsNational" PropertyAlias="newsTitle" Template="" ForceTemplate="false" FallbackNodeId="" Description="" /> <Route UrlSegments="/news/" Enabled="true" DocumentTypeAlias="" PropertyAlias="" Template="" ForceTemplate="false" FallbackNodeId="1364" Description="" /></Routes>
http://www.mydomain.com/news/this-is-a-news/ => Any content node which name matches "this is a news" and its content type is "newsInternational" or "newsNational" will be displayed
http://www.mydomain.com/news/ => The content node which id is 1364 will be displayed
v0.2.0 [2015-03-08]
-
Performance improvements and improved caching in order to remove from cache only items that are related with an updated content instead of clearing all the cache
-
Doesn't use embedded
resources anymore
(https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/61145-Packages-only-work-in-debug-mode)
v0.1.0 [2015-02-08]
- Initial release