Different content per subdomain


I’m new to Grav and I would like to make a website working with several subdomains. The content or html sections can be different per subdomain. For example:

site_main = www.example.com
about (html: site_main , content: site_main)
images slider (html: site_main , content: site_main)
features (html: site_main , content: site_main)

site_2 = site2.example.com
about (html: site_main , content: site_main)
introduction (html: site_2 , content: site_2)
contact form (html: site_2 , content: site_2)

site_3 = site3.example. com
about (html: site_main , content: site_main)
introduction (html: site_3 , content: site_3)
contact form (html: site_3 , content: site_3)

What is the best way to do this with Grav ? I think multisite setup cannot share content or theme between site.
Basically what I need is only conditions, for example if site=site_2 displays this content with this html.

Thank you.

I think you are right, Grav sites however set up cannot natively share content.

Here are two ideas that might work for you:

  • set up a folder containing shared content (pages) and use symlinks from your sites to the pages/folders you want
  • expose your page data as something like JSON with a Twig template, so you are making your unprocessed content available to anyone via a URL. Then you can request it and process it where you want it displayed. That’s kind of difficult to explain briefly, depends on some of your requirements, and will probably take a while to set up. I think in future, the Grav raw content will be available via URL out of the box.