Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

Different content per subdomain

Started by Cedric Simon 7 years ago · 1 replies · 498 views
7 years ago

Hi,

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
sections:
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
sections:
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
sections:
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.

7 years ago

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.

Suggested topics

Topic Participants Replies Views Activity
General · by Hanns Mattes, 12 hours ago
1 14 4 hours ago
General · by Andy Miller, 4 hours ago
0 11 4 hours ago
General · by Jerry Hunt, 5 days ago
2 137 1 day ago
General · by pamtbaau, 2 days ago
1 94 2 days ago
General · by Andy Miller, 2 days ago
0 78 2 days ago