# Exercise 7.1: URL aliases - Patterns

In this exercise, we’re going to automatically assign a URL alias pattern to the **Job Posting** content type so that all Job posting nodes will be assigned the URL alias format - <http://example.com/jobs/\\[node:title>]

## Add a new path alias pattern

1. Go to *Configuration* → *Search and metadata* → **URL aliases**, then click on the **Patterns** tab.

   Our new content type Job posting is not listed yet, so let’s create a new *Pathauto pattern*.<br>

   <figure><img src="https://3186608908-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzAsrTcKaHnLDg-7ALW%2Fuploads%2FiWMSTr9aO1Pu6DIDu1I6%2Fimage.png?alt=media&#x26;token=11d49e80-b777-42d6-92c2-4a9eb5fc447e" alt=""><figcaption><p>SHowing existing URL Patterns</p></figcaption></figure>
2. Click the **Add Pathauto pattern** button.
3. Select **Content** in the **Pattern type** selector.
4. Select the **Job Posting** checkbox in the **Content type** selector.
5. Enter **Job Posting** in the **Label** field.
6. We need to find out which token to use in the **Path pattern** field so that it automatically takes our **Job posting** title and converts it into a safe URL. To explore available tokens, click the **Browse available tokens** link. In the **Available tokens** pop-up, expand **Nodes** and find **Title** field. Copy the token provided (\[node:title]) and update the **Path pattern** field with **jobs/\[node:title]**
7. Review the values and **Save** the form.\ <br>

   <figure><img src="https://3186608908-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzAsrTcKaHnLDg-7ALW%2Fuploads%2FI7QbyY4MpnaocCuGA1bO%2Fimage.png?alt=media&#x26;token=e9cd6f9e-1e3b-4ac0-8e59-d512ac0babe1" alt=""><figcaption><p>Job URL alias pattern settings</p></figcaption></figure>

## Update existing paths

Now that we’ve created the new path alias, we also want to apply this new pattern to existing content, in this case **Job Posting** nodes. To do this, we’ll update all nodes on the site.

![Image of URL alias Patterns](https://3186608908-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzAsrTcKaHnLDg-7ALW%2Fuploads%2Fgit-blob-eaf5bb55a48a5d51d7dd6ed9abeaa165bebcd53c%2FEx-7-1-URL-Patterns-3.png?alt=media)

1. Click on the **Bulk generate** tab at the top of the **Patterns** admin page.
2. Select **Content** paths.
3. Select **Generate a URL alias for un-aliased paths only**.
4. Click **Update**.

The new URL alias pattern has now been applied to existing content on your site.

To test it out, create some new **Job Postings** and you’ll see *Pathauto* automatically adding the new URL alias pattern to the pages when they’re saved.

<figure><img src="https://3186608908-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzAsrTcKaHnLDg-7ALW%2Fuploads%2FkB2DZXOdWwww9t29pb5p%2Fimage.png?alt=media&#x26;token=80cbe040-c873-47b3-972d-fba1978bd9ab" alt=""><figcaption><p>Job alias is checked on creating a new Job Post</p></figcaption></figure>

{% hint style="warning" %}
**Note:** The URL alias field will only be populated *after* saving the content (as Draft, Needs review or Published).
{% endhint %}
