Currently, I have 3 sites set up in Craft 3 beta. I'm trying to get all my sites to share one asset folder by using absolute path. However, I can't seem to set it up. The siteUrl is not parsing as I would expect. I would get "{siteUrl}/assets/people/image.png".
2 Answers
Found out the answer on how to get all my sites on Craft 3 to share one image folder. So you have to set your base url for all your site to your original site's base url.
Then in your code, you just put {{ siteUrl }} before your image url. Kind of confusing since siteUrl is actually the Base Url in the dashboard.
Environment variables as a concept don't exist anymore in Craft 3. You can read about it along with the recommend replacements in the Craft 2 => 3 upgrade guide.
-
So I set up my siteUrl using an array but I'm not sure what 'siteHandle1' in the upgrade guide means. Could you please clarify that? I tried doing 'siteUrl' => ['web' => 'craft3.dev', 'web-dore' => 'dore.dev', 'web-exp' => 'exp.dev', ],– Holly DoSep 14, 2017 at 21:13
-
The site handle will be whatever the
handle
field is set to in the Control Panel under Settings->Sites.– Brad Bell ♦Sep 14, 2017 at 21:35 -
Ok, thank you. I've changed the handle as you have specified, but it is still not parsing the {siteUrl}.– Holly DoSep 14, 2017 at 21:47
-
You probably need to do something like
{siteUrl['web']}
,{siteUrl['web-dore']}
,{siteUrl['web-exp']}
, etc– RyanSep 15, 2017 at 0:48 -
@Ryan There is only one input field for the Base Url and I tried putting what you've suggested, but the siteUrl is still not parsing.– Holly DoSep 15, 2017 at 18:27