This tip will show you how to update the URL Aliases of many modules in a single page visit. To do this we will use VBO - Views Bulk Operations.
Automated URL Aliases via the PathAuto module provide a great way to make understandable and SEO friendly URL paths for your website's nodes. Frequently we miss setting the Automated URL Alias Settings provided by the PathAuto module until after we have created a bunch of nodes and content on our websites. In the past, the only recourse has been to go back and visit each of these nodes, edit and save them - creating their new automated aliases. Now we can use VBO, and update all the nodes' URL's in a single page submission!
The Setup
- You have a mess of node content on your site with obscure or meaningless URL aliases, or no aliases at all!
- You have just updated your Automated Alias Settings, provided by the PathAuto module
- To remedy the situation, you have installed the VBO module
The Process
- Follow the instructions to install the VBO module.
- Create a new view, and add a page display. This is the page that will be doing the work! I named my bulk-ops, which seems very pseudo-military.
- Under Basic Settings, set the Style Plugin to Bulk Operations.
- Click the setting button next to the Style to reveal the settings for Bulk Operations.
- You will see a long list of settings, and at the bottom you will see a list of "Selected Operations". Be sure to check the box in from of "Save post (node_save_action)".
- Add a filter for content type, and expose that filter. We can use this exposed filter to reduce the scope of our bulk operations to all the nodes of a specific content type.
- You can add more filters and expose them if that is helpful.
- Add some fields so you can see what nodes you will be selecting in the view.
- Save your new view, and visit the page of your new view.
- Select all of the nodes you want to alias or re-alias. This is where the content type filter will come in very handy. Using the filter to select all the nodes of a specified content type, and then use the 'select all' to select all of the nodes, or just check the nodes you want to update.
- In Bulk Operations, select Save Node and "Execute". That's when the magic starts!
- Once the view finishes, you should see a list of notifications of updated nodes and their URL replacements.
The Takeaway
Drupal and it's growing list of modules are making the tasks of creating and maintaining our websites easier. VBO provides an incredible resource for making short work out of tasks that used to be pretty time consuming and tedious. And the final result is that we have more time for thinking up new modules at Drupal Happy Hours!
~Wilbur Ince
http://willince.com