0

Before I go ahead and implement my site's architecture, I'd like to check whether or not it's valid.

I have two taxonomy vocabularies that I want to use as part of my Pathauto settings. My site is a local accommodation guide, so I'd like to implement a URL structure like this:

mywebsite.com/cottages/Whitby/Little-Cottage mywebsite.com/holidayapartments/Scarborough/Seaside-Apartment

                  ^                 ^             ^
                  |                 |             |----- Accommodation name
                  |                 |------------------- Location name
                  |------------------------------------- Accommodation type

Which follows the syntax mywebsite.com/[accommodation type]/[location]/[accommodation name]

Up until now, I've found it impossible to do this using just taxonomy tokens. I always end up with paths that look wrong.

A way around this seems to be to set each accommodation type as its own content type (for example, 'cottage' content types, 'holiday apartment' content types etc), instead of just having one 'accommodation' content type as I currently have then set the path settings for each content type like so:

Cottage content types: cottages/[termpath-raw]/[titlepath-raw] Holiday apartment content types: holidayapartments/[termpath-raw]/[titlepath-raw]

Whilst this seems to produce the result I want, it feels more like a compromise than the correct solution. Before I go ahead and do this, I want to check that there isn't another way of setting up the path structure that I want using taxonomy tokens.

I'm also wondering what happens when I introduce multiple vocabularies for those content types - how will I ensure that the location vocabulary doesn't get replaced in the URL structure by another vocabulary (for example, if I use a vocabulary for holiday types - family, group, singles, couples etc - how do I ensure that this vocabulary doesn't take the place of the location vocabulary?).

  • What do you mean by the "path looks wrong"? Please clarify what it looks like and why it is wrong. – Ashlar Nov 5 '11 at 4:08
  • I'll see if I can recreate it and post back its syntax later - but it's safe to say that I couldn't produce a path structure like the one I want to. – James Nov 5 '11 at 9:53
1

Okay, I've just had a look at my old test site and I can see that I'm using the following syntax:

[field_locations-term-raw]/[term-raw]/[title-raw]

This displays like so:

/grange-over-sands/holiday-apartments/test-property

The location comes before the page type (accommodation) here, which I'm aware of, but now the path is displayed perfectly! I've previously deactivated the Domain Access module, so I can only assume that it was DA that was causing my paths not to show correctly.

This leaves me with a new question,though, which I'll start separately.

1

I'm not too experienced with Drupal, however I am setting up a site where each node is tagged with 2 different vocabularies. Setting up the pattern and the entire taxonomy-browsing engine was quite a challenge for a beginner. I had been grinding the soil before I eventually got what I wanted.

I would risk a conclusion that for term browsing, it'd be impossible to get the pattern you desire. You would probably need to change your approach and treat the path branches as arguments (contextual filters) for a View.

You might however get this structure to work, if you chose to use that pattern as a path for final nodes, something like:

[node:accommod_categ:type]/[node:location_categ:name]/[node:accommod_categ:name]

(This assumes that each node is tagged with 2 mandatory terms) But this would be a single node view only, rather than a category overview, which is probably what you want to supply for a web visitor.

Interesting challenge, btw, I'd be glad to see your results when you're done. Hope you find a spare minute to describe us how you did it. Good luck!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.