Pattern Syntax: Pathauto

Last updated on
30 April 2025

Overview

Drupal forms supported:

  1. Automated alias settings (/admin/build/path/pathauto)

Available actions:

  1. pathauto

Depends on the following modules:

  1. path
  2. pathauto

Valid elements for "pathauto" action

  • verbose
  • separator
  • case
  • max_length
  • max_component_length
  • max_bulk_update
  • update_action
  • transliterate
  • reduce_ascii
  • ignore_words
  • punctuation_* - punctuation settings - use patterns for helper to get full list of punctuation elements
  • node - node path settings (see below)
  • taxonomy - taxonomy term path settings (see below)
  • user_pattern - pattern for user account page paths
  • user_bulkupdate - set to 1 to bulk generate aliases for users that are not aliased
  • reset - set to 1 to reset all settings to default values

valid elements for node and taxonomy path settings:

  • default - Default path pattern
  • "content_type_name" - Pattern for all "content_type_name" paths
  • X - Pattern for all vocab X paths (where X is vocabulary vid)
  • vid_X - same as above but required in XML since element names can't begin with number
  • bulkupdate - set to 1 to bulk generate aliases for nodes/terms that are not aliased
  • applytofeeds - internal feed alias text

valid values for "punctuation_*" elements:

  • 0 - Remove
  • 1 - Replace by separator
  • 2 - No action (do not replace)

prefix "pathauto_" can be left out from all the element names.

Examples

YAML

  - tag: pathauto
    separator: -
    max_bulk_update: 200
    punctuation_underscore: 1
    punctuation_hyphen: 1
    node:
      default: content/[title-raw]
      page: "[title-raw]"   # quotes are reuqired here because [] has a special meaning in YAML
      bulkupdate: 1
      applytofeeds: feed
    taxonomy:
      default: category/[vocab-raw]/[catpath-raw]
      2: articles/[vocab-raw]/[catpath-raw]
      3: products/[vocab-raw]/[catpath-raw]
      bulkupdate: 1
      applytofeeds: feed
    user_pattern: users/[user-raw]
    user_bulkupdate: 1

XML

    <pathauto>
      <separator>-</separator>
      <max_bulk_update>200</max_bulk_update>
      <punctuation_underscore>1</punctuation_underscore>
      <punctuation_hyphen>1</punctuation_hyphen>
      <node>
        <default>content/[title-raw]</default>
        <page>[title-raw]</page>
        <bulkupdate>1</bulkupdate>
        <applytofeeds>feed</applytofeeds>
      </node>
      <taxonomy>
        <default>category/[vocab-raw]/[catpath-raw]</default>
        <vid_3>articles/[vocab-raw]/[catpath-raw]</vid_3>
        <vid_2>products/[vocab-raw]/[catpath-raw]</vid_2>
        <bulkupdate>1</bulkupdate>
        <applytofeeds>feed</applytofeeds>
      </taxonomy>
      <user_pattern>users/[user-raw]</user_pattern>
      <user_bulkupdate>1</user_bulkupdate>
    </pathauto>

Help improve this page

Page status: Not set

You can: