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.

The URL comes by default when you create the “Webpage” content type. 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:

url.png

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:

  1. Log in to Contentstack using the Authtoken and use the stack’s Management Token to authorize your API requests.
  2. Make the Add stack settings API Request.
    You can use any third-party REST API clients to run API calls, e.g. Postman.
  3. 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.

Unique_URL_Option.png

API Reference

To enforce unique entry URLs via API request, refer to the Add stack settings API request.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

^