“In learning you will teach, and in teaching you will learn.”
Words spoken by (or, at least, attributed to) the great Phil Collins (side story: my first conversation with anyone at InterWorks was with Aaron Confer discussing Genesis and Phil Collins). During my last training at OSU, I definitely learned something new.
For people brand new to Drupal, I typically start with the basics – creating and editing content. Doing this covers about 70% of what most non-developers will do with their Drupal sites. Next up is creating menus and menu items. When creating menu items, I teach that one should use “node/nid” in the alias. This is typically so that the menu item keeps the menu link even if the alias changes, which can happen if the title of the node changes (say, for an updated news item).
If you don’t know what an alias is, an alias is the part directly after your domain. For example, in https://www.interworks.com/company/our-team, “company/our-team” is the alias. And Drupal has a couple of really good modules that handle path aliasing.
Pathauto is one that I like a lot. Pathauto allows admins to set a pattern for each content type that will automatically assign an alias as each new node is created. For example, in a News content type, the pattern can be set to use the published date and title to form the alias. So instead of being example.com/node/17 or example.com/content/[title], it could be /news/[node:created:custom:Y]/[node:created:custom:m]/[node:created:custom:d]/[title], which would output example.com/news/2013/04/19/node-title.
Redirect is kind of like Drupal’s built-in aliasing on steroids. It offers different types of redirects (300 through 307. More about redirection codes here: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection), helps fix 404 pages, and even a few extra settings like expiring redirects.
Global Redirect runs in the background and helps to optimize the alias process. It does an auto 301 if the current URL is not being used, checks for and removes the trailing slash, checks and redirects to the homepage if needed, and several other things. The module creators note that Global Redirect not only gives you clean URLs but can help protect your site from being sandboxed, since Drupal doesn’t remove the original (node/1234) path and, with two paths pointing to the same content can be seen as a bad practice to search engines.
So, from my training, I learned that, even if one adds the clean alias to the menu item, Drupal will automatically convert it to the “node/nid” format. So instead of having to teach users (especially beginners) how to find the node ID, you can just put in the alias and you’re good to go.
tl;dr: Use the clean alias when creating menu items. It’s easier to remember and Drupal converts it to “node/nid” anyway.
Happy aliasing.
Setting the Path Alias:
Creating the menu item path using the clean alias:
Confirmation of Drupal converting the menu item path from a clean alias to the node/nid: