1

I'm trying to do something like this in general.php config for a multi-site setup:

// ...
'production' => array(
    'myVariable' => array(
        'site1Handle' => '111',
        'site2Handle' => '222',
    ),
),
// ...

So, when we do:

{{ craft.app.config.general.myVariable }}

We can get different values ("111" or "222") based on which site I'm on.

I believe that we can do something similar to this in Craft 2 (was multi-lingual though). See https://docs.craftcms.com/v2/localization-guide.html#step-4-define-your-site-urls

Can we still do this in Craft 3?

2
  • 3
    How about {{ craft.app.config.general.myVariable[currentSite.handle] }}? Oct 17 '19 at 10:33
  • @DedNolyxeux good solution. Thanks Ded!
    – Wei
    Oct 22 '19 at 2:12

Your Answer

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

Browse other questions tagged or ask your own question.