Copied to clipboard

Flag this post as spam?

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


  • HelloHelloHelloHello 1 post 71 karma points
    Mar 18, 2021 @ 10:11
    HelloHelloHelloHello
    0

    Can Umbraco host slightly different versions of the same site on different domains?

    Hello, I'm new to Umbraco and I'm having trouble figuring out how to do this.

    I have two companies with different names and web domains that basically have the same website, except for the logo and a few other content items like the phone number, email address, location, etc.

    I'm trying to avoid having to make two completely different sites and then having to make all future content updates to both versions.

    Ideally there would be only one version of the site, and then a settings file where I could define a series of variables/values that would be swapped in depending on which domain my customers are visiting.

    Does anyone know how to do this in Umbraco?

    Thanks in advance for your help!

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Mar 18, 2021 @ 11:20
    Marc Goodson
    0

    HI HelloHelloHelloHello

    Yes, one way to do this, if you currently have your site in Umbraco, then right click the top node of the site, and choose Copy, and then choose the 'Content' top section as the place to copy it too.

    You'll then have two sites at the root level of the content section.

    The right click the top node of each of these two sites and choose, Culture and HostNames

    Here you can specify two different domain names one for each site.

    Umbraco will route requests for each domain to the appropriate content tree.

    Now your 'templates' will be the same across both sites, so you are only 'implementing' in one place.

    You can add properties to the homepage doc type like 'Company Name', Company Logo etc' and write these out in your templates, allowing you to have the same template for both sites, but vary by the content entered...

    You can set the 'Start Node' of any editors of the sites so that when they login they don't see the other companies content!

    But you'll need to think that the 'Redirects dashboard' isn't clever enough to only show redirects from one site, to somebody logged in who only has permissions to edit one site etc

    And if you build a site search, you'll need to tell it to only search content from a particular tree etc

    But it is possible.

    Other approach would be to have all the implementation in source control - 'your platform' and then push this out to different Umbraco sites for each different company, using the same trick for customizing certain properties, but having the published site in it's own Umbraco, so if a company wanted to move to another supplier, you could just hand it over... much harder if it also includes other companies data!

    regards

    Marc

  • Amir Khan 1287 posts 2744 karma points
    Mar 18, 2021 @ 12:59
    Amir Khan
    0

    I gathered that's what they're trying to avoid. Is there a way to do this by reading the incoming domain request and adjusting things? Curious as I'm having a similar situation.

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Mar 18, 2021 @ 14:30
    Marc Goodson
    0

    @amir, ahh yes

    But you could have a shared area for most of the content, and then just pull that content into the different content trees that are setup for each domain?

  • Amir Khan 1287 posts 2744 karma points
    Mar 18, 2021 @ 15:08
    Amir Khan
    0

    Yes, but simple example, lets say for swapping a logo, this checks if the page is the child of a page and adjusts the favicon, but is it possible to say if the domain is domain1.com then do show this favicon? Same language so can't use cultures as far as I know.

    @if(CurrentPage.IsDescendantOrSelf(Umbraco.Content(18105))) {          
    <link rel="apple-touch-icon" sizes="180x180" href="/pm-apple-touch-icon.png">            
    }
    
  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Mar 18, 2021 @ 17:01
    Marc Goodson
    0

    I'd be thinking

    • Site A - www.siteA.com
    • Site B - www.siteB.com
    • SharedContent - NoUrl Set

    I would therefore allow Umbraco to map the incoming Url to Site A or Site B using Culture and Hostnames setting.

    And on that SiteA and SiteB node I'd have things that was different that effected the chrome of the site....

    Then in SharedContent I'd have the actual content pages so

    • SharedContent/About-Us
    • SharedContent/News
    • SharedContent/Services

    Then when a request comes in for a URL eg

    www.siteA.com/about-us

    That page 'doesnt' exist in Site A' in the way a usual Umbraco site would, and so you'd expect a 404,

    but you could have a custom IContentFinder, https://our.umbraco.com/documentation/reference/routing/request-pipeline/icontentfinder

    That uses the request URL to 'look up' for matching content in the SharedContent area, and if it finds a match, constructs a virtual content item that lives under the SiteA site, with the content from the shared node...

    Same with the request to SiteB

    Your template reads the properties from the site node like company logo, name etc, but you build your navigation etc, up from the Shared Content nodes...

    ... if you then had a page that actually really was just for SiteA, you could create it under SiteA, and if you positioned your IContentFinder behind the Umbraco core one, then it would serve the page from SiteA, before defaulting back to the shared lookup if the request was for SiteB...

    so gives a bit of flexibility if some pages do turn out to be different.

Please Sign in or register to post replies

Write your reply to:

Draft