Blueprint Developer Manual / Version 2404
Table Of ContentsRequirements
Editors should be able to define special URLs to special content objects which are easy to remember.
Solution
Vanity URLs are special human readable URLs which do not contain any technical identifiers like content item IDs. CoreMedia Blueprint provides a means to assign vanity URLs to content objects.
Vanity URLs are configured in channel settings. Typically, there is one Vanity URL settings
content item for the root channel of a given site. This is the setup chosen for CoreMedia Blueprint
demo content. To find the Vanity URL settings content item, open the root channel of a site and
switch to the Settings
tab. You will find the Vanity URL settings content item link
inside the Linked Settings
section.
Vanity URLs are defined as a relative URI path. The path might consist of several segments, but
if you would like to keep your Vanity URLs simple, just use only one path segment. The URI path
is then prepended with a path segment consisting of the site name. For example, for the site
corporate
, a URI path of my/special/article
would yield the Vanity URL
/corporate/my/special/article
.
To add a Vanity URL for a content item, follow these steps:
Select the
StructListProperty
vanityUrlDefinition
and create a new child Element Struct by clicking the [Add item to List Property] symbol in the toolbar.Create a new
LinkProperty
and name it "target".Set the content type field to the type of your target content item.
Click on the value field, this will open the library window. Drag your target content item from the library window into the value field.
Create a
StringProperty
, name it "id" and type your vanity URI path inside the value field.
Once the settings content item is published, the new Vanity URL is reachable on the live site, and it is used for all generated links referring to the target content item.
Note
While it is possible to define multiple Vanity URLs for a single target content item it might cause confusion when looking on the links of the website. By default, the first "id" in the settings content item that refers to the target content item will be used for link creation.
Note
Defining multiple target content items for a single Vanity URL is not prevented by the Studio but it is usually not desired. A link will be generated for every target but the resulting URL will only point to the content item referenced by the first occurrence of the "id" in the settings.
Caution
A Vanity URL can overlap with other dynamic URLs on your website. A Vanity URL will always take precedence. Consequently, the content item behind the other dynamic URL will not be reachable on the website anymore.