Use Default URL Pattern
The URL field properties allows you to add multiple types of prefix URLs for your entry.
Note: The Basic tab under URL Properties is only visible for the content types that are of the “Multiple” type. For content types that are of the “Single” type, only the Advanced tab is visible.
When you create a content type, the URL field is not present by default. Click on the + (Insert a field) icon to add the URL field to your content type.
Once the URL field is added, open the URL Properties.
Here you can add a URL prefix under URL Pattern for your entry, for example, "/blog". By default, the selected pattern when you open URL Properties is Custom.
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.