4

In Drupal 7.12 i use pathauto, cleanurls, transliteration, i18n.

When i edit one node i saw that, "Generate automatic URL alias" in unchecked. Then i checked other nodes and saw that for all type of nodes it became unchecked.

I'm pretty sure that it was checked until last week.

The last modifications i made: I updated Pathauto module, installed Transliteration, installed Debug Cron module.

So, how can i re-enable this checkbox in node settings page automatically ?

(Of course i can i that manually, by editing every node, and checking the check-box)

Thank you very much for your help.

6 Answers 6

6

If you have Pathauto installed, it will generate path aliases for your nodes. It unchecks the box when there's already a path alias, letting you know that it won't change the alias if you change the content. You can change this behavior with the 'Update action' setting here: /admin/config/search/path/settings

2
  • Thank you for help. In my settings this was checked "Create a new alias. Leave the existing alias functioning." Should i check another one?
    – trante
    Feb 18, 2012 at 20:55
  • Depends on whether you want to generate a new URL every time the node is edited.
    – paul-m
    Feb 20, 2012 at 2:33
3

Read the documentation page on How does Pathauto determine if the 'Automatic URL alias' checkbox should be checked or not?.

If the checkbox is unchecked on existing nodes it means that the current alias for the node does not match the alias that Pathauto "would" generate for the node. Maybe if you changed the patterns for your nodes, it would mean they're "out of sync" with the real patterns and then Pathauto un-checks the checkbox by default.

1
  • This is a great insight and a useful documentation link. We regularly see nodes losing the checkbox, even despite the fact that pathauto_persist is on. Remaining problems we see: 1) how should the user notice that some nodes (often among tens of thousands) became unchecked, 2) how to check them back on without hacking about in the database.
    – Vacilando
    Nov 27, 2014 at 10:29
3

if you want to force it, even if it's unchecked,just create a module as follow :

<?php
function pathauto_checkbox_node_presave($node){
  global $user;
  if($node->type=='you_content_type'){
    $node->path['pathauto']=1;
  }
}
?>

if you want for every type just remove the "if" condition

2
  • I think this code needs to save again the node.Is this possible to force that without saving the node?thanks
    – Dion
    Mar 11, 2013 at 11:05
  • It's been a while now, but I think if you do a bulk update, it should be okay.
    – GwenM
    May 6, 2013 at 0:36
1

Also you can do it using:

$node->path['pathauto'] = TRUE;
0
0

Some of my contents url were manually generated , some other not. I wanted to homogenize all content by content types and did not want to do it one by one

I have defined patterns in

admin/config/search/path/patterns

then

  delete all alias and did a bulk update

this action reset all content to automatically generated alias

0

You can do this using View's arbitrary script also for the node which is already created and the automatic path creating for all nodes in false (i.e "Generate automatic URL alias" is not checked.)

enter image description here

Here I have created a view to updating the path from "node/[node-id]" to "automatically generated URL".

Follow the below steps.

  1. Create the view as shown in the above image
  2. Go to the view page.
  3. Select the option from the dropdown and the node from the list for which you want to check the checkbox "Generate automatic URL alias" as shown in the below image. enter image description here

  4. Click on execute. Now on next step enter the code. Then

$node = node_load($entity->nid);
$node->path['pathauto'] = TRUE;
node_save($entity);
  1. Click on confirm. Once completed, go to that node.

  2. edit the node and check the checkbox "Generate automatic URL alias" is checked now. and path is also created automatically enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.