hello,
I’m managing a website with 4 different languages (organized in 4 sub trees), of which 1 is english. Now we need to split out this english tree into a UK part and a global part (and maybe more later on). While these trees will likely differ on some pages, still a lot of pages will contain exactly the same content (about 50).
How would I do this? We are very concerned with SEO so we do not want different URLs for pages that are the same (because that would create duplicate content). Still, we would like pages that are different be linked to according to the website that is visited. For example if you go to www.mycompany.com/uk/ you would get a different page than when you would go to www.mycompany.com/en/, but if you click on ’software’ in either menu, you would get the same page (e.g. www.mycompany.com/en/software). After that, when you click home again, you would have to be taken to the respectively homepages. I hope this makes sense.
I have been thinking about extending the modx core and creating a ’shadow document’ which acts as an instance of another page. These shadow documents would have to be created when the user gives a command like ’shadow copy’ instead of the usual ’copy’. Shadow copies could individually be ’instantiated’, turning them into real pages and thus allowing them to be edited. Doesn’t really fix the duplicate content problem yet though.
I could probably pull this off but I don’t really feel like hacking modx, so what would be the events I would have to look in to?
I can’t help with the code, but I think that this is a great idea. I have often thought that a ’page alias’ or a ’shadow page’ would be a great effective way to have pages repeat without actually having duplicates.
-
MODX Staff
- 10,725 Posts
If I understand what you are wanting, I could see something like this being accomplished by simply creating a TV, maybe content-uk, then using a snippet (or possibly a plugin) to replace the [*content*] tag with [*content-uk*] if it contains the alternate content. Or you could use this technique consistently in all your templates by just creating a snippet to handle the process of determining whether or not to display the main content or a specific piece of shadow content, based on a session variable indicating the user’s preferred language identifier. For the manager, you could look at ManagerManager plugin to hide the main or shadow content, also based on manager user preferences, if needed.
What I was referring to is the ability to have the same document available in two containers. So that you could have the same document in two locations in the document tree to take advantage of the document tree based navigation (ie Wayfinder) as well as have a visual representation of the document within the tree. I currently accomplish this as you suggested but I need to have two independent documents and apply some handy work to pull the content from the original document, and this is a bit beyond the skills of my clients. With a ’shadow page’ or an ’alias’ you could simply select the locations you want the document to show up and place it there so that it will show up in the correct place in the navigation and have a centralized document for editing. And if you could do this for an entire container it would rock. I hope I was able to explain what I mean, and that this is what the original poster meant as well.
I see this beeing used in sites with multiple languages as well as situations with product catalogs.
-
MODX Staff
- 10,725 Posts
That’s what weblinks are for, or do you mean you want duplicate content on different final URLs? If so, create a document and place a snippet in it that uses $modx->sendForward($originalDocumentId) to display the content of the forwarded page at the URL of the shadow document.
-
MODX Staff
- 10,725 Posts
Ok, just use a plugin OnPageNotFound to detect the shadow URLs by looking up the real document ID after transforming the alias (since it’s a predictable pattern, this should be easy to do) and then use $modx->sendForward($realDocumentID) if you find a match. The page will remain on the shadow URL, but show the content of the forwarded document ID, with a 200 response.