Hi,
how can I create aliases for book pages?
I want create aliases as follows:

mywebsite.com/book-title/page-parent1/page-parent2/page-title

I cannot find any tokens to achieve this. Is it possible in D7?

Comments

Nic0w’s picture

Hi,

I have the same problem.
So, if someone had an solution, it would be great !
I already tried Node Hierarchy, but it's redundant with the main goal of Book which is... hierarchizing.

Thanks in advance !

naisan’s picture

In D7, when you're on the page to edit the URL Aliases (assuming you have pathauto enabled, it is: "Home » Administration » Configuration » Search and metadata » URL aliases" ), you will need to click the "replacement patterns" item in each section, which will list the tokens.

Here is a snip from my drupal site (note I didn't expand all the tokens ;):

Book [node:book] The book page associated with the node.
Edit URL [node:book:edit-url] The URL of the menu link's edit page.
Link ID [node:book:mlid] The unique ID of the menu link.
Menu [node:book:menu] The menu of the menu link.
Description [node:book:menu:description] The optional description of the menu.
Edit URL [node:book:menu:edit-url] The URL of the menu's edit page.
Machine-readable name [node:book:menu:machine-name] The unique machine-readable name of the menu.
Menu link count [node:book:menu:menu-link-count] The number of menu links belonging to the menu.
Name [node:book:menu:name] The name of the menu.
Parent [node:book:parent] The menu link's parent.
Edit URL [node:book:parent:edit-url] The URL of the menu link's edit page.
Link ID [node:book:parent:mlid] The unique ID of the menu link.
Menu [node:book:parent:menu] The menu of the menu link.
Parent [node:book:parent:parent] The menu link's parent.
Edit URL [node:book:parent:parent:edit-url] The URL of the menu link's edit page.
Link ID [node:book:parent:parent:mlid] The unique ID of the menu link.
Menu [node:book:parent:parent:menu] The menu of the menu link.
Parent [node:book:parent:parent:parent] The menu link's parent.
Root [node:book:parent:parent:root] The menu link's root.
Title [node:book:parent:parent:title] The title of the menu link.
URL [node:book:parent:parent:url] The URL of the menu link.
Root [node:book:parent:root] The menu link's root.
Edit URL [node:book:parent:root:edit-url] The URL of the menu link's edit page.
Link ID [node:book:parent:root:mlid] The unique ID of the menu link.
Menu [node:book:parent:root:menu] The menu of the menu link.
Parent [node:book:parent:root:parent] The menu link's parent.
Root [node:book:parent:root:root] The menu link's root.
Title [node:book:parent:root:title] The title of the menu link.
URL [node:book:parent:root:url] The URL of the menu link.
Title [node:book:parent:title] The title of the menu link.
URL [node:book:parent:url] The URL of the menu link.
Absolute URL [node:book:parent:url:absolute] The absolute URL.
Alias [node:book:parent:url:alias] The alias of the URL.
Internal path [node:book:parent:url:path] The internal Drupal path of the URL.
Relative URL [node:book:parent:url:relative] The relative URL.
Root [node:book:root] The menu link's root.
Edit URL [node:book:root:edit-url] The URL of the menu link's edit page.
Link ID [node:book:root:mlid] The unique ID of the menu link.
Menu [node:book:root:menu] The menu of the menu link.
Parent [node:book:root:parent] The menu link's parent.
Root [node:book:root:root] The menu link's root.
Title [node:book:root:title] The title of the menu link.
URL [node:book:root:url] The URL of the menu link.
Title [node:book:title] The title of the menu link.
URL [node:book:url] The URL of the menu link.
Absolute URL [node:book:url:absolute] The absolute URL.
Alias [node:book:url:alias] The alias of the URL.
Internal path [node:book:url:path] The internal Drupal path of the URL.
Relative URL [node:book:url:relative] The relative URL.

tomas.teicher’s picture

yes, you are right. I didn't noticed these tokens because they were collapsed.
Thank you
Tomas

lucacerone’s picture

Hi everybody,
can you please help me to set the right tokens for my auto path?
I would like to have all my books ordered in a way similar to "books/BookName/ChapterName/SectionName/...../BookPage" but i can't manage to make it work.
I have tried to set: "books/[book:root:title]/[book:parent:title]/[book:title]"
but it is not enough recursive....

It would be great if somebody could give me a hand on this!.
Thanks in advance,
Luca

greeshma’s picture

Hi tomas.teicher,

Go to /admin/build/path/pathauto
And, in the "Node paths" section, set "Pattern for all Book page paths" as follows:
[bookpath-raw]/[title-raw]

It worked fine for me.

Hope this will help you too..:)

lucacerone’s picture

Thanks Tomas,
it worked.
Cheers, Luca

binarylime’s picture

Hi, what was the solution for this? I also want a recursive token that includes all the parents. Thanks.

lucacerone’s picture

So that it can help all the others, this has worked for me:
[node:book:parent:url:alias]/[node:book:title]

rooby’s picture

[node:book:parent:url:alias] is not a valid token.

This works currently:
[node:book:parent:url:path]/[node:book:title]

druvision’s picture

[node:book:parent:url:path]/[node:book:title] works for me too.

Anonymous’s picture

That gave an error, cant contain more than one token.
I got another code from one site [node:book:parent:parent:parent]/[node:book:parent:parent]/[node:book:parent]/[node:title] it worked for me http://vision4life.in

rooby’s picture

That is not a great solution unless you know all your book pages are going to have the same number of parents.

eloivaque’s picture

I have a same problem

Botafoc.cat -> Drupal 8 base distribution. Focused on making a base distribution of drupal. The idea is compile the typical modules and configurations that is in vast majory sites using drupal.

Beltanin’s picture

I've read everything on this page, and tried every combo I can think of, and just not getting anywhere. Extremely frustrated. What am I missing?

I'm looking for a url alias for a book content-type with a child content-type...

/{section}/{book title}/{page title}

{section} is a field in the book content-type, and I've got the book pattern working perfectly fine [node:field_section]/[node:title]
ie. /health/immunizations

It's just the child page (scheduling), I can't seem to get it's parent book url into the page alias.
ie. /health/immunizations/scheduling

Please help.

rooby’s picture

Beltanin’s picture

It comes up with "array" instead of any value. However, I'm going to look more into it. It's got to be possible.

druvision’s picture

Thanks @rooby, [node:book:parent:url:path]/[node:book:title] works for me too

skaught’s picture

[node:book:parents:join-path]/[node:book:parent:title]/[node:book:title]

naveenagrawal’s picture

[node:book:parents:join-path]/[node:book]

This works great for my website http://sciencedefine.com/units-and-measurement

rwilson0429’s picture

[node:book:parents:join-path]/[node:book:title]

ReggieW

alysaselby’s picture

[node:book:parents:join-path]/[node:book:title]

junsuwhy’s picture

Now is using like :

[node:book:parent:url:path]/[node:nid]

referrencing : https://www.drupal.org/node/1265672
"The [url:alias] tokens are now [url:path]; The [url:path] tokens are now [url:unaliased:path]"

defconjuan’s picture

For Drupal 8 use this:

[node:book:parents:join-path]/[node:book:url]