We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13226
    • 953 Posts
    Sorry for the delay in getting back on this, I am very busy at the moment.

    I may have a partial solution to your problem

    Looking at this a little closer, it is actually feasible and can be accomplished using a trick or two.

    You can also get around the SEO duplicate content by using a "Canonical Link" in the meta tags.

    What I have found that works is:

    Get hold of the GetField snippet: http://modx.com/extras/package/getfield

    Install it as the instructions tell you to, after you have installed it follow the steps below:

    Step 1:

    I created a main product folder and added a few products, lets say: Product 1 + Product 2 - See image called "MP-PRD1.jpg"

    So the menu looks like:

    Products
    => Product 1
    => Product 2

    Step 2:

    Create a Template Variable and call it: "MainPrdId" (Just for info, this stands for Main Product ID) - See image called "MainPrdId.jpg"

    You can set the template variable to - Input Type: Number

    The template variable will be used in the GetField snippet calls.

    Step 3:

    Create a new template - call it "Child" or whatever you want (will be used by the child documents in the tag / category folders) - See image called "ChildTPL.jpg"

    For my demo I used the following template code:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title></title>
    </head>
    <body>
    </body>
    </html>

    Now that you have the template, go to the "MainPrdId" Template Variable and assign it to this template - and only to this template.

    Step 4:

    Add the relevant snippet calls and elements that are required in your template.

    For my demo I need the title tag, canonical meta tag and the content area:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>[(site_name)] | [!GetField? &parent=`1` &parentLevel=`1` &field=`pagetitle`!] | [*pagetitle*]</title>
    <link rel="canonical" href="[(site_url)][~[!GetField? &docid=`[*MainPrdId*]` &field=`id`!]~]">
    </head>
    <body>
    [!GetField? &docid=`[*MainPrdId*]` &field=`content`!]
    </body>
    </html>

    As you can see, the template has multiple "GetField" calls in it - what they do is get the information from the designated documents field you require

    In this case I want the:

    • Direct parent pagetitle for the title tag - e.g. Big
    • The pagetitle from the product page (in the tag / category section)
    • The ID of the main product page (for the canonical link)
    • The "content" TV from the main product I am replicating

    Tip:

    Hide the content area for all docs that use this template with ManagerManager as it will never be used.

    Step 5:

    Set up the tag / categories - See image called "TAG-PRD1.jpg"

    For ease of use I simply duplicated the main product folder from Step 1 as you get a copy of all docs inside it as well.

    I renamed the main folder to the Tag name e.g. "Big"

    I then removed all of the content from the child documents, you should only have the main page info e.g. Title, Long title, Description etc.

    Once all of the info was removed I changed the template to the "Child" template

    Once the manager reloaded the page, the "MainPrdId" template variable was available.

    To reflect the Product, add the products ID into the "MainPrdId" TV - If you take a closer look at the "TAG-PRD1.jpg" you will see that the ID is "4" - this was to test that it was working correctly

    Product 1 in the tags should have the ID of Product 1 from the main product folder - in my case it should be "3"

    Save the document and look at it in your browser

    an example:

    Main product: domain.com/products/product-1.html
    Category / tagged product: domain.com/big/product-1.html

    In both cases, your product-1.html should be visually identical - look at the HTML source code and you will see that the canonical link is set to the main product page and the title tag has the tag in it - Big

    Take a look at the image called "TaggedSource.jpg"

    Conclusion

    For management, this is, I think, the best way to go.

    When you modify the original document, the tagged document is in a way also updated, as the GetField snippet calls the content from the original document.

    Google shouldn't have a problem with this set-up as they know via the Canonical link that the parent page is the page that should be used

    Drawbacks = I dont know, as this is new land for me [ed. note: iusemodx last edited this post 10 years, 6 months ago.]
      • 13226
      • 953 Posts
      Just to be on the safe side:

      I am by no means a "GetField" expert

      I don't know if it can only call certain MODx fields or if it can also call custom TV's that are used in a page.

      I would suggest getting a PHP'r to look at the snippet code to see if it can call custom fields / TV's.

      I can imagine if the full functionality is there, that you could replicate a product with all fields without having much problems.

      Calling the snippet in the template Cached or Uncached all depends on your page set-up and what's called in it.

      I also don't know if this could / would conflict with other snippets, chunks etc. it's all trial and error.

      So at the end of the day:
      If it works = Great
      If it doesn't work = It was worth a try