Drupal Module - Pathauto

Drupal Pathauto module

As you might be already knowing that Drupal by default assigns a node number to its content. Any page or post can be accessed usually via yoursite/node/123 .  This is oblivious not very sensible or even gives any idea about the content.

To overcome this Drupal provides an option of having a URL alias that you can set  i.e. you can access the content yoursite/node/123   via say "yoursite/blog/2024/drupal/modules/path-auto " .  This URL clearly makes more sense is also SEO friendly.

Now the issues is that when you manually do the same you may not remain consistent with he URL format for you - say blog posts.

To overcome the same you can use the Drupal Pathauto module.  This modules allows you to automatically generate URL aliases for your different content types based on a predefined pattern.

Install the module as usual and enable the same.   

Note the module depends on the  Token modules for generation of better paths.

To add a new path pattern go to 

  • Administration > Configuration > Search and metadata
  • Under this select "Pattern"
  • Click on "Add new pattern"
  • Select a "pattern type" as "content"
    • Then select the content type for which you want to add a URL alias pattern.
    • Let us say we select - "Article"
  • Now we want a path say "yoursite/article/year/month/date/title"
    • For the same we the fixed words can be set directly, for other we can use the token browsers from the link "Browse available tokens."
    • Select suitable tokens and format them accordingly
    • Here our path pattern will look like:
      • article/2024/Feb/22/Drupal Module - Pathauto
    • Explanation of the tokens:
      • 2024  is replaced with the year in 4 digits.  The year is from the date when you created the content.
      • Feb is a custom date retrieval token to get the month part from the date when you created the content.
      • Thu is a custom date retrieval token to get the date part from the date when you created the content.
      • Drupal Module - Pathauto is a token to retrieve the title of the content. 
    • So if we create an article now as of today date "22 Feb 2024" with tile "How to use path auto module in Drupal" we will get a URL like
      • yoursite/article/2024/feb/22/how-use-pathauto-module-drupal
      • It should be noticed that words like "in", "to" etc are dropped from URL and also the URL is set to lower case.  These setting cab be found under the "setting"  of the URL alisa patters section.

That's it download pathauto and generate URL aliases automatically.

Main category

Add new comment

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
Enter the characters shown in the image.
Are you a robot?

"Natraj"  Bungalow,
Colony No.7,  Sr.No. 38.
(Lane Behind Sai Baba Mandir)
Kale Borate Nagar, Hadapsar,
Pune - 411028.
Get Directions