Pathauto >= 7.x-1.3

Pathauto now stores the state of the 'Automatic URL alias' checkbox in the database, in the pathauto_state table. This functionality was previously offered by Pathauto Persistent State module and has been merged into the Pathauto module with #936222: Merge in pathauto_persist module functionality to prevent losing manual aliases with node_save() calls.

Pathauto <7.x-1.3

Pathauto uses the following logic (listed by priority) to determine if the Pathauto checkbox should be checked when editing a node:

  1. If the node is a new node, it defaults to having an automatic alias.
  2. If the node is not a new node:
    1. If the node does not currently have an alias, it assumes that the node was manually un-aliased, so it will default to not have an automatic alias.
    2. If the node's current alias matches the alias that Pathauto would generate based on the pattern, then it will default to checked.
    3. Otherwise, the checkbox will default to be unchecked.

If you are using the Pathauto persistent state module, then once you save a node, the checkbox will remain checked or unchecked regardless of the logic above until you check or uncheck it later.

(Drupal 8) If you have nodes you've created before installing Pathauto and running Bulk Generate does nothing, because the Automatic URL alias checkbox is unchecked for these items:

  • go to /admin/content/
  • filter by the Content Type you want
  • select all (or choose the items you want
  • choose "Update URL alias" from the Action dropdown

This will process each item, generating an alias according to your Patterns. It won't change the status of the "Generate automatic URL alias" checkbox, but that will be checked for when adding a new node of that Content Type.

If you are saving changes to nodes automatically using node_save, you need to specify $node->path['pathauto'] = FALSE; in Drupal 7 or $node->pathauto_perform_alias = FALSE; in Drupal 6 (see http://drupal.org/node/1179988) in order to stop pathauto overwriting any custom paths you might already have for the node.

Comments

Marko B’s picture

This $node->pathauto_perform_alias = FALSE; is the thing I need in http://drupal.org/project/autotag module as it auto tags and saves node and makes new aliases wheter you want it or not. So this seems like the right thing to use as pathauto persistane module won't help here. Anyway great thinking of module developement and possible use case scenarios, I am sure you acutally used all of this so you knew what is needed.

ñull’s picture

I noticed that errors in the path pattern settings can influence this behaviour. When there is an error, for instance the use of a non-existing token, then the aliasing won't work at all, when you create a new node. While it was set to create an alias automatically, because of the error, it did not and will be default never do. Be careful to check the pattern setting every now and then, because updates may also outdate some of the tokens used there.