Question

I'm not sure if this is the appropriate place for this question (I'm a self-proclaimed newbie)...I have a vocabulary with the following scheme:
category1
   subcategory1a
   subcategory1b

I'm trying to create a URL pattern for the content path so it has the following URL pattern: category1/subcategory1a/[node:title]. I have Drupal 7.22, Entity API 7.x-1.0-rc3, and Pathauto 7.x-1.1 and have been trying different token patterns in the URL aliases section. If I set the pattern to be [node:field-VOCABULARYNAME]/[node:title], then the URL alias generated is: category1-subcategory1a/[node:title].
Is there a way to have a "/" appear between the parent term and subterm instead of a dash?

Or is there a way to create the pattern: [node:field-VOCABULARYNAME:0]/[node:field-VOCABULARYNAME:1]/[node:title]?

The tokens related to individual content items ("nodes") listed are:
[node:field-VOCABULARYNAME]
   [node:field-VOCABULARYNAME:1]
   [node:field-VOCABULARYNAME:2]
   [node:field-VOCABULARYNAME:3]

If I set the pattern to [node:field-VOCABULARYNAME]/[node:field-VOCABULARYNAME:1]/[node:title], then the URL alias generated is: category1-subcategory1a/subcategory1a/[node:title].

In my content type, I have the field set up as a Hierarchical Select widget with Term reference as the field type.

I found this StackOverflow post (Drupal 7: Pathauto hierarchical taxonomy terms pattern) and it seemed most relevant to me, but I do not have the taxonomy term tokens listed.

Thank you for your guidance

Was it helpful?

Solution 3

This link provided the answer for me: https://drupal.stackexchange.com/questions/27141/how-can-i-use-pathauto-to-generate-urls-for-deeply-nested-vocabularies.

I needed to enable the Taxonomy Entity Index module & then could enter [node:terms:join:/]/[node:title] as the pattern under "Content Paths" & used [term:parent:name]/[term:name] under "Taxonomy Term Paths" & got the desired results.

I hope this helps someone!

OTHER TIPS

Hi this should do what you are looking for:

[node:field-VOCABULARYNAME:parents]/[node:field-VOCABULARYNAME:name]/[node:title]

Make sure to update "taxonomy term paths" under the "bulk update" afterwards.

This is a pattern that I have been using to structure my term URLs like so "/parent/parent/term"

browse/[term:parent:parent:name]/[term:parent:name]/[term:name]

Replace [term:name] with [node:title]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top