3

A url for my site looks something like this:

www.mysite.com/best-sellers/mistery/novels/this-is-a-book-title

I want to remove "best-sellers" from that chain. I'm using PathAuto to generate my paths. The pattern I'm using is: [node:menu-link:parents:join-path]/[node:title]

I assume I can use Custom Tokens to create a custom token to use and get my desired url. The plan was to get the parent's for a current node, remove the first item (that uppermost parent), and spit out a url string that would result in this:

www.mysite.com/mistery/novels/this-is-a-book-title

Is this making any sense? Am I going about this the wrong way? Any suggestions on how to get this desired result?

  • Drupal nodes does not have any parents. You can emulate it any way you want. So the way to do it "right" is to define what you want to consider node's parent, and then build everything on it. Usually most people want to use menu parents, but menu items does not need to correspond to nodes, and even if they do, it is not 1:1 relation. – Mołot Nov 13 '13 at 12:29
  • Do I need to create a custom token to use within PathAuto then? – dcp3450 Nov 13 '13 at 13:57
  • A custom token would still require you to create a relationship in some fashion with the parent node. How are you planning on mapping your nodes? If it's the menu then that does exist. Otherwise, perhaps you want a Node Reference (or Entity Reference) to a parent node. There would be a token available for that. – Alex Laughnan May 15 '15 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.