Documentation for the worlds leading Java Based Open Source Web Content Management System

dotCMS

URL Map - SEO Friendly URLs

The URL Map feature on dotCMS content structures* is a very easy way to create friendly URL's for Search Engine Optimization as the content is contributed.  The URL map is one of the system fields that are automatically created any time that a new structure is saved.  A URL pattern can be placed on the structure so that front end requests matching the pattern are directed to the detail page indicated on the structure.   This documentation site, for example, utilizes the URL map attribute on the documentation structure so that all content can be reached using an SEO friendly URL Path:

/docs/{sinceVersion}/{wikiTitle}

There is really only one HTML page that is serving up ALL of the dotCMS documentation you are currently reading.  The documentation structure has two required fields: sinceVersion and wikiTitle.  As content is contributed, these fields build the URL path and pass the matching piece of content to the detail page.  This occurs automatically through the use of the URL Map field on the structure as seen in the example image below:

 

URL Map

For example, the piece of documentation you are reading is a piece of content that has several fields, two of which match the following:

  • sinceVersion = 1.9
  • wikiTitle = URLMapSEOFriendlyURLs

This is why the URL path at the top of your browser is /docs/1.9/URLMapSEOFriendlyURLs even though the "docs" and "1.9" directories do not exist. Actually there is only one HTML page which is serving up all of the documentation and all of the content in the repository is building its own virtual URL path in your browser on the detail page (configured to the documentation index page)!

The matching content then accessable as a Velocity variable : $URLMapContent

Important Note:  URL Mapping can be configured in the dotmarketing-config-ext.properties file to redirect or fall through (default).  Changing this configuration file needs to be done in a plugin. (See Configuration documentation)

  • Fall Through (default)- this setting forces a check on a matching pattern to a piece of content first, then, if there is no match the path falls through to check if there is a matching dotCMS object whose path matches the URL path- most likely an HTML page.
  • Redirect- always redirects to the detail page as set on the structure.  Detail page should be set up to handle page visits that do not match URL pattern to a piece of content

*For more information, please see the documentation on Creating a Content Structure.

2

Subscribe to dotcms

Visit this group