CMS: Making Multiple Dynamic Page URLs Unique

3 min read
You may want to learn about the following before you read this article: 
Every dynamic page you create must have a unique URL. Remember that your dynamic page URLs have dynamic and static sections. These sections affect uniqueness differently. 

  • Static sections: The content of the static sections of your URL count towards uniqueness. For example, recipes/menu/{meal} is unique, but so is recipes/Menu/{meal}, because Menu is different than menu
  • Dynamic sections: The sections and their location in the URL count towards uniqueness, but not the field they reference. For example, recipes/menu/{meal} is not unique as compared to recipes/menu/{course}, because they both contain recipes/menu followed by a single dynamic section. The fact that in one case the dynamic section filters on the meal field and the other filters on the course field does not affect the uniqueness of the URLs. However, recipes/menu/{meal} is unique as compared to recipes/{meal}/menu, because the dynamic section appears in a different location in the URL. recipes/menu/{meal} is also unique as compared to recipes/menu/{meal}/{course}, because one URL has one more dynamic section than the other.

Let's look at how this can affect the way you set up dynamic pages. Let's say you have a recipes site with a recipes collection. Besides the fields that contain the recipe information, your collection has a meal field where you note if the recipe is for breakfast, lunch, or dinner. It also has a course field that notes if it is an appetizer, main, or dessert.

Let's say you create a dynamic item page for your recipes with a URL like this:

Now you want to create a dynamic list page to display your recipes based on the meal field. You might try to define a URL like this:

However, if you try to create a page with this URL, you'll get an error that you can't use it because the URL isn't unique. This is because both URLs follow the identical pattern of recipes/{some-dynamic-field}. Remember that the content of the dynamic fields doesn't count towards uniqueness, so meal and Title are considered identical.
Only the static parts of the URLs are case sensitive. 

Editing Your URLs to Make Them Unique

To make your URLs unique, you need to manually edit them to add or modify existing static sections. When you click in the URL to edit it, the dynamic sections you added are enclosed in { }, so they look like this: http://www.../recipes/{meal}.

When you make a dynamic list page, it's recommended that you manually add the category to the URL to make it unique. For example, the URL for the meal page would be http://www.../recipes/meals/{meal}, and the URL for the course page would be http://www.../recipes/courses/{course}.

This would make the actual URL for your breakfast meal page be http://www.../recipes/meals/breakfast, and the URL for your main course page be http://www.../recipes/courses/main.

However, you can modify existing dynamic sections or add anything you want to the URL after the site name to make it unique. 

Making Sure Your Calculated URLs Are Unique

Because the URL of a given dynamic page is calculated from the data in your collection, it is essential that the contents of the fields that make up your dynamic page URLs are unique. In other words, if you have multiple recipes for cupcakes and their Title field all say "cupcakes," they will all have the same calculated URL. This creates an unstable situation where you can never know which dynamic page is displayed. 

Note that the dynamic part of the URLs is not case sensitive. This means that if you have one recipe called "cupcakes" and another "Cupcakes," only one of them will be displayed no matter how the URL appears.