5

I will build a group site in craft which will have the main domain and multiple sub domains. e.g. domain.com property.domain.com connect.domain.com

The news feed on each sub domain will be different but it will all display on the main domain news feed. The site build etc for each will be similar but content will be different.

What is the best way to set this up in Craft?

Is the following something which can be done.

Use Multi Environment Config to set the SiteURL for each domain. Point all the domain/sub domains to the 1 public folder.

Within my main _layout.html template file detect what the siteurl is and based on that include different header and footer files for each sub domain?

The same news template files can then be used. And just use a different structure for the nav on each sub domain.

Is that workable and the best way to do it or should I be having different root folders for each sub domain?

3

The approach you described is interesting and should actually work. Separate root folders would allow you to define the template folders individually (→ see Ben's answer on how to set this up), but it looks like that's not what you need and your subdomains are more part of one and the same site.

Even with multiple root and template folders you could still include shared template partials, but sharing CSS, JS and assets would be troublesome. But, then again, more easy to have these individually for each subdomain.

  • I'm just not sure the best approach to take and that was the first that came to mind. Sharing css/js/assets would be troublesome just with multiple root and shared templates? – mmc501 May 15 '15 at 21:20
  • Say for the news feed if assets are added to an article they would need to be accessible from all domains. Articles would need to appear on the subdomains but all would appear on the main site. Would I be better setting those up as separate channels or just the 1 and use categories to specify what site it is for? Suppose if an article needs to appear on 2 sub domains it would need to be 1 channel? – mmc501 May 15 '15 at 21:24
  • Ok, this now reads even more like your subdomains are just subpages and you're more interested in sharing things than separating them, which all speaks for the one root folder idea. You can have shared CSS, JS and assets above the root, so no problems on that front (relative, root relative or absolute using your multi-env siteUrl variable). – carlcs May 15 '15 at 21:54
  • You can join channels in a template easily via craft.entries.section('news1, news2'), so I'd probably rather decide on how you want the content to be structured in the CP, what makes the most sense from the data entry and also the CP index views. With separate channels you're stuck with separate index views, with one channel and categories you can view them in a combined index table and in individual ones using P&T's Category Sources plugin. – carlcs May 15 '15 at 22:02
  • Thanks - a lot of things cleared up in my head now! Better getting it right before starting. – mmc501 May 15 '15 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.