I would like to make a tree of taxonomy terms and keep the child-parent relationship. So something like


I couldn't find a way to do this with core, so I'm using the Views Tree module. By following the instructions on the module page, I can output a hierarchical, bulleted, unordered list with proper indentation for the child terms. However, I want to rewrite the fields as links like:


I'm using Fields:

 - Taxonomy term: Term ID
 - (Parent) Taxonomy term: Term ID
 - (Parent) Taxonomy term: Name
 - Taxonomy term: Name

only the last field is visible, and I have a relation "Taxonomy term: Parent term". All this is per the instructions on the Views Tree page. When I try and rewrite the field link using Fields->'taxonomy term: Name'->Rewrite Results->Output this field as a link->Link Path and use the replacement patterns in the form:


('name' references the term's parent name (if it exists); name_1 references the term name itself) it works fine for the child terms, since both parent and child are defined, I get:

test/<term's parent name>/<term name>
(e.g. test/Parent1/Child1)

However, the parent term links are rewritten as:

test//<term name>
(e.g. test//Parent1)

since the parent terms themselves have no parent. Any suggestions on how to make this work? I'm willing to scrap this module and try something else, but I couldn't get it working with core either.

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.