cs-icon.svg

Use Default URL Pattern

After learning the basics of Default URL Pattern, in this article, you will learn how to use it.

Note: The Default URL Pattern feature is only available for the “Webpagecontent types that are of the “Multiple” type. It is not available for “Webpage” content types that are “Single” and for “Content Block” content types.

When you create a “Webpage” content type, the URL field is present by default. Click on it to open its Edit Properties window as shown below:

image.png

Here you can see the available URL Pattern options for the URL of the entries within a content type. By default, the selected pattern for URL is /: title.

Now, let us understand the other keywords that can be seen in the above screenshot

Under the URL Pattern section, you will see the URL Prefix part that defines an intermediate path where the entry resides, for example, “/my-first-article” and “/my-second-article” can be two entries under the “/blog” page. In this case, enter “blog” as the prefix URL in the given space. This may differ from case to case, as different entries may belong to different categories or content types.

You can choose one of the following URL patterns for the entry-specific URL:

  • Title: This option will automatically take the value entered in the Title field as the entry’s relative URL. The text will be hyphenated and in lower case.

    Example:

    Title: My first page
    Default URL Pattern: baseURL/:title
    Auto-generated URL: www.examplesite.com/my-first-page
  • Date and Title: This option attaches the date of creation (YYYY/MM/DD) as well as the title of the entry to the URL.

    Example:

    Title: My first page
    Created_at: 04 April 2016
    Default URL Pattern: baseURL/:created_at[YYYY/MM/DD]/:title
    Auto-generated URL: www.examplesite.com/2016/04/04/my-first-page
  • Month and Title: This option adds the year/month of creation (YYYY/MM) and the title of the entry to the URL.

    Example:

    Title: My first page
    Created_at date: 04 April 2016
    Default URL Pattern: baseURL/:created_at[YYYY/MM]/:title
    Auto-generated URL: www.examplesite.com/2016/04/my-first-page
  • Custom

    : This option lets you set a custom pattern for the URLs by using available variables or custom text, or a combination of both. The variables available for the custom pattern field are given as follows:

    • :title: Displays the title of the entry in the URL (for example, www.examplesite.com/my-first-page)
    • :unique_id: Displays the unique ID of the entry in the URL (for example, www.examplesite.com/abcd1234)
    • :year: Displays the year of creation (numeric) in the URL (for example, www.examplesite.com/2016)
    • :year_short: Displays the short version of the year of creation (numeric) in the URL (for example, www.examplesite.com/16)
    • :month: Displays the month of creation (numeric) in the URL (for example, www.examplesite.com/05)
    • :monthname: Displays the name of the month of creation in the URL (for example, www.examplesite.com/january)
    • :monthname_short: Displays the short version of the month name in the URL (for example, www.examplesite.com/jan)
    • :day: Displays the day (numeric) of the creation in the URL(for example, www.examplesite.com/30)
    • :year-:month-:day: Displays the year/month/date of creation (for example, www.examplesite.com/2016-04-30
  • Disable: If you select this option, the relative path will be kept blank by default. You can then enter your own URL while creating the entry.

Example 1: If you use /:title/:created_at[MM] /:created_at[DD] in the custom field, your URL will look like this: www.examplesite.com/my-first-page/04/30 can also enter custom text in the URL along with the variables.

Example 2: If you use /home/:title/blog/:created_at[MM] /:created_at[DD] in the custom field, your URL will look like this: www.examplesite.com/home/my-first-page/blog/04/30

Note: Setting a URL pattern will simply generate the URL for the entry and populate it in the URL field. You can edit or change the URL anytime while creating or edit the entry.


Was this article helpful?
^