A well-structured URL is essential for organizing content and enhancing user experience. In Contentstack, the Default URL Pattern feature helps you define a standardized structure for your URLs, ensuring consistency across your website.
Note: You can add a URL field while creating or editing a content type.
To add a URL field to a content type, log in to your Contentstack account and perform the following steps:
Tip: You can also click the vertical ellipsis icon in the Actions column next to the content type and select Edit.
Once the URL field is added, you can define a URL prefix for your entry under the URL Pattern section.
Example: If you set /blog as the prefix, all entries under this category will have URLs like:
www.examplesite.com/blog/my-first-article
www.examplesite.com/blog/my-second-article
The prefix helps structure your content by category, making navigation and SEO optimization easier.
You can select from various available URL Patterns to determine how the entry’s unique URL is structured:
Automatically generates a URL based on the entry title. Spaces are replaced with hyphens (-), and text is converted to lowercase.
Example:
baseURL/:titlewww.examplesite.com/my-first-pageIncludes the entry creation date (YYYY/MM/DD) along with the title.
Example:
baseURL/:created_at[YYYY/MM/DD]/:titlewww.examplesite.com/2016/04/04/my-first-pageThis pattern includes only the year, month (YYYY/MM), and title of the entry.
Example:
baseURL/:created_at[YYYY/MM]/:titlewww.examplesite.com/2016/04/my-first-pageAllows you to create a custom structure using available variables, custom text, or both.
The following variables can be used in the custom pattern field:
:title: Uses the entry title (e.g., /my-first-page).:unique_id: Uses a unique ID (e.g., /abcd1234).:year: Displays the full year (e.g., /2025).:year_short: Displays the short year (e.g., /25).:month: Displays the numeric month (e.g., /05).:monthname: Displays the full month name (e.g., /january).:monthname_short: Displays the short month name (e.g., /jan).:day: Displays the numeric day of the creation in the URL (e.g., /30).:year-:month-:day: Displays the URL creation date in the YYYY-MM-DD format (e.g., /2024-06-15).Example 1:
/blog/:title/:created_at[MM]/:created_at[DD]www.examplesite.com/blog/my-first-page/04/30Example 2:
/home/:title/blog/:created_at[MM]/:created_at[DD]www.examplesite.com/home/my-first-page/blog/04/30This approach provides greater flexibility in structuring URLs based on your content strategy.
If you select Disable, the relative URL field will remain blank, allowing you to manually enter a custom URL when creating an entry.
You can edit or modify the URL anytime while creating or editing an entry.
Using the Default URL Pattern ensures that your URLs are SEO-friendly, user-friendly, and structured, making your content more accessible and easier to manage.