1

We are building a multi-site set up in Craft. We will have a lot of "microsites" for different locations.

I have a site group called "Microsites" and I would like the home page for each of these sites to load a template inside /templates/microsites/index.twig

I don't want to create individual folders in the template folder for each site.

Is this possible?

Edit: I'll provide overview of the site setup

So I will have over 100 different sites on here representing a location. We have a Locations channel on the main site that will hold the data we will query in the Microsite template.

Each microsite will have its own base URL like so:

@web/san-francisco

so whenever that page is loaded, I want it to go into /templates/microsite/_index.twig

Every single microsite home page will use that same template and have the data be loaded dynamically.

The reason we can't just use Channel entries is because we will need localized blogs for them.

Maybe I'm going about this all wrong?

  • 1
    Why don't you use the very same template for all of them and include another one based on the site group? include '.../.../' ~ entry.getSite().getGroup().name ~ '/index.twig' – Robin Schambach Mar 20 '19 at 20:54
  • Hi thanks for this. I'm strangely getting Variable "entry" does not exist. on all but one site in my site group. Even the main primary site does that – millman2394 Mar 26 '19 at 15:46
  • The code above only works for entry routes so if you don't route via entry but via custom routes you'll need to add a site indecator by yourself. It was more an example how it could be done, if you route via category or something else you need to adept it – Robin Schambach Mar 26 '19 at 16:11
1

It's not ideal, but you can use one template folder for each group and then create symbolic links for all the language sites.

| improve this answer | |

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.