URL
The URL field enables you to define a relative path of your webpage (for example, /home or /projects/new-project) where you want to publish the content.
You can edit the field properties and set a default pattern for the URLs of the entries of a specific content type.
Additional Resource: You can read more about Field Visibility Rules in our documentation where we have covered it extensively
Note: If you have set your content type as Single, then you cannot set properties for the URL field.
Additional Resource: To know how to use Default URL Pattern, please refer to our documentation on Use Default URL Pattern.
After configuring this field in content type, you will see it on your entry page as shown below:
Note: You can only add the URL field at the parent level; it cannot be added within modular blocks or group fields.
Additional Resources: You can also redirect URLs, to know more, read our documentation on Redirecting URLs.
Enforce Unique Entry URLs Using the Content Management API
You can ensure that entry URLs across the stack are not duplicated using the Content Management API.
To enforce unique URLs using the API, perform the following steps:
- Log in to Contentstack using the Authtoken and use the stack’s Management Token to authorize your API requests.
- Make the Add stack settings API Request.
You can use any third-party REST API clients to run API calls, e.g. Postman. - Within the “Body” section of your API request, specify the "enforce_unique_urls": true parameter to maintain unique URLs across the stack.
Once you run the above API request, the URL field inside an entry immediately throws an error when it detects a duplicate URL. You cannot proceed further without entering a unique URL.
API Reference
To enforce unique entry URLs via API request, refer to the Add stack settings API request.