What is a Drupal URL alias and how do I create one
Posted by on 17 January 2013 04:52 PM

When you create a page using Drupal, the Drupal system refers to it as a node. By default, Drupal assigns it an address such as http://www.dcu.ie/node/30111. In order to make pages easier to find, Drupal allows you to create a more readable address for each node such as http://www.dcu.ie/iss/index.shtml. This is called a URL alias.

It is a requirement that all pages created in Drupal have a URL alias created before they are published to the DCU website.

Where to enter the URL alias

When creating new content, you'll find the URL alias field under the URL path settings section at the bottom of the Add Content page overlay, near the Save and Preview buttons, as shown below:

Where to enter the URL alias

Format of the URL alias

The URL alias should be consistent with the format used on other pages on the DCU website. You can see an example below:

DCU URL alias format

Section 1

N.B. This part of the URL (http://www.dcu.ie/) is automatically generated by Drupal. You do not need to type this part of the URL so in the example above the text you would fill in the URL alias box would be:

iss/drupal-tutorial.shtml 

Section 2

This part of the URL alias is the folder structure, as set up by the ISS Web Team when initially creating your department's website. What you type in here should be consistent with other pages on your department's website. It is usually also the same as what you select from the Department drop-down when creating a page.

Some exceptions include where your department site is within another section of the website or a parent department's site, e.g. the URL alias for the sites of various departments within Student Support & Development start with students/careers/, students/access/, students/counselling/ etc.

You may also wish to add another level to the folder structure to better organise your site into sections, e.g. using hr/forms/ so that your URL becomes http://www.dcu.ie/hr/forms/form-1.shtml or students/careers/newsletters/ for an URL that reads http://www.dcu.ie/students/careers/newsletters/january-2012.shtml.

Section 3

This section should generally reflect the title of your page. It should:

  • Be short,descriptive relevant. Three words or less.
  • Be all lowercase letters.
  • Use hyphens between words. You should not use spaces or underscores.
  • Be unique from other pages within your site. Drupal will not allow duplicates of the same alias.

Section 4

The URL alias should always end in .shtml

Format of the URL alias when creating a News Article

The format of the URL alias you should create is mostly the same when creating a news article, with some slight differences as follows:

Section 2

This part of the URL alias follows the same format that it would do for a normal basic page (see instructions and graphic above), with some slight differences. After the part of the URL set up by ISS for your department, e.g. iss/, students/access/ or dcubs/, you should news/, e.g iss/news/news-article-jan-2013.shtml.

Section 3

When creating section 3 of your URL alias for news articles, it can be useful to add part of the date to the URL alias - e.g. iss/news/news-article-jan-2013.shtml as this can help keep URL aliases unique and descriptive.

Additional suggestions for sites with frequently updated news sections

If you post news articles to your site very frequently or may have articles with similar titles, it can be useful to year and month layers to the URL alias - e.g. iss/news/2013/jan/news-article.shtml. This isn't strictly necessary and doesn't affect how articles are stored in Drupal, but it can be helpful to allow users to see at a glance when the article was posted.

If using this method, Section 2 of the URL alias should always be in the format department/news/yyyy/mon/, where "department" is your department name as normally used in your URL, "yyyy" is the year in 4-digit format, and "mon" is the month in lower-case, three letter format

Three letter month names

  • jan
  • feb
  • mar
  • apr
  • may
  • jun
  • jul
  • aug
  • sep
  • oct
  • nov
  • dec

It is important that you are consistent with which option you pick. Either use the regular option, i.e. department/news/news-article-title-jan-2013.shtml or the extra date layers option, i.e. iss/news/2013/jan/news-article-title.shtml, but don't use a mixture of both.

General Notes

  • The URL alias should always be lowercase letters, and use a hyphen instead of spaces or underscores.
  • The URL alias should be consistent with other pages of your department's website.
  • You do not need to enter in a forward slash (/) before your URL alias. Drupal will add this automatically.

Examples

CorrectCorrect IncorrectIncorrect Reason

iss/drupal-tutorial.shtml

/iss/drupal-tutorial.shtml

You do not need to enter in a forward slash (/) before your URL alias

iss/drupal tutorial.shtml

Do not use spaces in the URL alias

iss/Drupal Tutorial.shtml

Do not use capital letters and spaces in the URL alias

iss/Drupal-Tutorial.shtml

Do not use capital letters in the URL alias

iss/drupal_tutorial.shtml

Do not use underscores in the URL alias

iss/drupal_tutorial

Do not use underscores in the URL alias, the URL alias should always end in .shtml

iss-drupal_tutorial.shtml

Use a forward slash to separate the folder structure and use hyphens between words

iss/tutorials/drupal-tutorial.shtml

iss/Tutorials-1

User lower-case letters only, use a forward slash to separate the folder structure, and the URL alias should always end in .shtml

iss/tutorials/1

The URL alias should always end in .shtml

iss/news/new-drupal-tutorials-live.shtml

iss/news/new-drupal-tutorials-live-jan-2013.shtml

iss/new-drupal-tutorials-live.shtml

News articles should include /news/ in the URL alias.

They may also include the date as part of Section 3 (see above) where relevant.

iss/news/2013/jan/new-drupal-tutorials-live.shtml

iss/news/jan2013/new-drupal-tutorials-live.shtml

News article URLS broken down by date should be in the format /YYYY/mon/article-title.shtml, where YYYY is the 4 digit version of the year and mon is the three letter version of the month name.

iss/news/2013/january/new-drupal-tutorials-live.shtml

News article URLS broken down by date should be in the format /YYYY/mon/article-title.shtml, where YYYY is the 4 digit version of the year and mon is the three letter version of the month name.