Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Tom van Enckevort 100 posts 387 karma points
    Apr 13, 2017 @ 11:12
    Tom van Enckevort

    Use different parent node with ContentFinder

    So I have a multi-site setup with different sites (each with their own domain name) and a bunch of nodes that get shared across those sites:

    • Site 1
      • Listing
    • Site 2
      • Listing
    • Site 3

      • Listing
    • Shared Content

      • Node A
      • Node B

    I'm using a UrlProvider and ContentFinder implementation to assign the URLs to Node A and Node B for Site 1, 2 & 3. This works fine and I can see the assigned URLs in the CMS and when I go to it will load the correct node through the ContentFinder.

    But the problem I have now is that to render things like the navigation/header/footer on that page I need to get the root site node. Normally I could do Model.AncestorOrSelf(1) (or Model.Site() in v7.5+) to get the site root node, but in this case it will get me the root node of the Node A content node (which is Shared Content).

    What is the best way to get round this?

    Can I somehow 'override' the parent node inside the ContentFinder when it assigns the IPublishedContent to the PublishedContentRequest?

    Or would I need to get the virtual parent node (Listing in Site 1) by parsing the request URL and getting that node via the URL name instead?

  • Jamie Pollock 172 posts 841 karma points c-trib
    Apr 13, 2017 @ 11:23
    Jamie Pollock

    Hey Tom,
    Would something like this help?

    If you scroll down to three bottom there is some code regards finding the correct site root of the publishedContentRequest is different from the domain root.


  • Tom van Enckevort 100 posts 387 karma points
    Apr 13, 2017 @ 12:19
    Tom van Enckevort

    Thanks Jamie, that thread does contain a few pointers I can play around with.

Please Sign in or register to post replies

Write your reply to: