0

I'm just curious how other Drupal developers handle nested path aliases when they are based on another page's url pattern.

I have a product landing page (it's a "basic page" node). When it's created, right now, the url is:

/product

For my product nodes, I set up a path alias to be

/product/[node:title]

This makes my product detail pages nicely nested under "product." This works fine for a while. But later, if someone changes the product landing page url, the alias for the product nodes will not match.

Say someone edits the product landing url to be:

/widgets

Then I have a /widgets landing page and a bunch of product nodes with urls like /product/product-name.

Is there a nice way to handle this? Or is it up to content creators to just know they need to update it?

1 Answer 1

1

You should use Pathauto if you aren't already.

This has a feature (tab) that lets you bulk update the content type urls to /widgets/[node:title].

You should also install the Redirect module, so that all your former /products/[node:title] automatically redirect to /widgets/[node:title]. This is for SEO purposes, you don't want your Google listing pointing to a broken link, non-existent page.

2
  • Thank you. I am using Pathauto. I guess there's no better way. I just have to hope that the site admins we train remember to run the bulk update. I was just hoping there might be some way of automating that. I wish I could have an alias like /[node:21:title]/[node:title]. But I know it doesn't work that way.
    – xpersonas
    Commented May 13, 2019 at 13:46
  • You could if you create your own token
    – No Sssweat
    Commented May 13, 2019 at 22:55

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.