1

Multisite question.... how do I output the site into the assets path? currentSite won't work because its the admin panel, so the current site is always the default site.

Using the below, I will always get /default/footer-content with this, regardless of which site is having its field edited.

enter image description here

1
  • So, I got this to work accounting for the ?site=foo parameter in entries and the /admin/globals/foo/globalsethandle formats used in globals .... but this feels ultra fragile. {{ craft.request.getParam('site')|length ? craft.request.getParam('site') : craft.request.getSegment(2) }}/footer-content – cherrykoda Feb 22 at 3:14
3

Try using {site.handle} instead of {{currentSite.handle}} and it should work ok.

1
  • Here are the docs on the "object syntax" used for Entry URI formats: craftcms.com/docs/3.x/entries.html#entry-uri-formats - The answer given above is a shortcut for {object.site.handle} - good to know if you ever need to use entry data in the URI - it's all accessible under the object variable. – James Smith Feb 22 at 12:46

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.