2

Drupal beginner here.

I'm working on a site which uses the Sites module to create location-specific URL's for all nodes. So say we have three locations: New York, London and Hong Kong. Plus Global of course. Then the Sites module prefixes each node URL with the location in order to serve up some locally relevant content in some cases, but the nodes are generally pretty much the same for all locations. So a blog post (article node) with the title The year ahead would have the global URL /blog/the-year-ahead and the location-specific URL's /newyork/blog/the-year-ahead etc.

The thing I want to do is add the global, unprefixed version of the URL as the canonical URL so search engines would not see duplicate content for a whole bunch of "different" urls. We have the Metatags module installed, so adding a default canonical metatag shouldn't be hard, but I noticed Sites inserts the prefix at a pretty early stage so using tokens in the metatag admin interface proved futile. I also tried a whole bunch of array value replacement in the various preprocess scripts, but to no avail (either no canonical meta tags would show or there would be duplicates). So I thought I would ask here before I pull out the regexp's!

EDIT: My issue is actually two-fold: 1. Get the global url, 2. Insert is as a meta tag. I have found no solutions to either.

TL; DR: For a Sites-module created URL like /newyork/blog/the-year-ahead I want the canonical meta tag to contain /blog/the-year-ahead. I have not found a good way to accomplish this.

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.