In my pattern for pathauto I'm using [nodesymlink:menu-link:parent:url:path]/[nodesymlink:menu-link:title] and for menu items that are children of the front page it is prepending <front> to the beginning of the url instead of just leaving it blank.

Perhaps it's an issue with the nodesymlinks module. Has anyone had this issue before? The urls still work, but I don't want the text <front>/ in front of my urls.

  • i've used nodesymlinks but am not familiar with the bug you are describing.
    – tenken
    Commented Oct 10, 2014 at 15:15
  • The issue is with pathauto. I'm using the pattern [node:menu-link:parent:url:path]/[node:title] and I have the same issue even though I'm not using nodesymlinks. I'll post more info when found as I'm trying to work on a fix for this. Cheers.
    – Mario Awad
    Commented Oct 28, 2014 at 19:01

1 Answer 1


As stated in my comment above, the issue is with pathauto and not with nodesymlinks.

Basically, pathauto is replacing the standard [node:menu-link:parent:url:path] or your [nodesymlink:menu-link:parent:url:path] with the <front> slug instead of just removing it when the parent menu item is the front page.

I have been looking into a fix and couldn't find any. This is why I wrote a custom module to remove the front slug from the paths generated by pathauto. I'm including the link to future proof the answer in case the post gets updated and I'll also copy/paste the full code at the end of this answer.

Also, if you're a beginner, follow the link for more info on how to create a custom module in Drupal 7 and the like. Otherwise, just drop this code into your custom module and it should fix the situation you're describing. The function's code is well commented in case you need extra info.

Good luck.


 * Implements hook_pathauto_alias_alter().
 * Needed so that we remove the buggy slug <front> from paths when their
 * nodes are a sub-menu-item of the front page while using this pathauto 
 * pattern: [node:menu-link:parent:url:path]/[node:title]
 * If the parent is the homepage, all menu child entries will get <front> 
 * added to the beginning of their URL alias which looks really ugly and 
 * doesn't work on all operating systems. We need to remove it.
 * Pathauto 7.x-1.2 doesn't handle this properly. Maybe later versions will.
function yourmodule_pathauto_alias_alter(&$alias, array &$context) {
    //Init the slashed front slug value
    $front_slug_slashed = '<front>/';

    //If the alias contains the slashed front slug, remove it
    //Note that pathauto will later check if the generated slug is a duplicate
    //and append an incrementing number to it so no need to worry about this
    if(strpos($alias, $front_slug_slashed) !== false) {
        //Save the non-modified alias for logging
        //Note: no better way to clone a string in PHP?
        $original_alias = $alias . '';

        //Remove the front slug from within the alias
        $alias = str_replace($front_slug_slashed, '', $alias);

        //Log to Drupal's watchdog as notice
        $msg = '';
        $msg .= 'Altered pathauto alias from "' . check_plain($original_alias);
        $msg .= '" to "' . check_plain($alias) . '"';
        watchdog('sk', $msg, array(), WATCHDOG_NOTICE);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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