Velo: Making Dynamic Page URLs Meaningful with Prefixes
Before reading this article you may want to read:
The first section after the domain name of a dynamic page URL is the prefix. The prefix can help make your page URLs more meaningful for your visitors.
For example, recipes is the prefix in the following URL:
Every time you use a new prefix for a dynamic page URL, a new section is created in the sidebar for all pages with that prefix. This allows you to group pages in one section even if they are connected to different collections in your database.
Tip: When you create a dynamic page, the name of the collection that your page connects to is automatically added as the prefix to the URL. This prefix is only a suggested default and does not affect how your page connects to your collection. If you want to use a different prefix for your page, edit the URL and change it manually.
Let's look at an example to understand why this is useful. Let's say you have a site for a restaurant, and you keep your menu information in different collections: meals and beverages.
Your meals collection has fields like dish name, allergy information, calories, which meal it's served for, and other meal-related information. Your beverages collection has fields like name, type of drink, domestic or imported, price per glass or bottle, and other drink-related information.
Now you want to create dynamic pages to display your meals and beverages by category, but you want all those pages to be under the common URL prefix menu.
To do this, you would create your dynamic pages with the URL https://my-restaurant/menu followed by other sections that make your URLs meaningful, and then fields that filter the dynamic content. In the end, you might have the following dynamic URLs:
- https://my-restaurant/menu/dishes/{meal}
- https://my-restaurant/menu/drinks/{type}
In this case, menu is the prefix and dishes and drinks are additional sections you might manually add to your URLs to make them more meaningful.
Your final page URLs would look like this:
- https://my-restaurant/menu/dishes/breakfast
- https://my-restaurant/menu/dishes/lunch
- https://my-restaurant/menu/dishes/dinner
- https://my-restaurant/menu/drinks/beer
- https://my-restaurant/menu/drinks/wine
- https://my-restaurant/menu/drinks/scotch
- https://my-restaurant/menu/drinks/soda
Now your page URLs communicate meaningful information for your visitors. The prefix also controls how your dynamic pages are grouped in the Pages menu.