3

I have a template that displays in both http and https environments. When pulling my images for the https environment I need to be able to change the URL to https:// from http://. I tried

{{ gist.gistImage.first().getUrl('gistUnit')|replace({'http': https}) }}

based on the documentation here twig.sensiolabs.org/doc/filters/replace.html

Not working. Is this because getURL() gets processed after the filter?

3

Try using:

{{ gist.gistImage.first().getUrl('gistUnit')|replace({'http': 'https'}) }}
1
  • 2
    even better: replace({'http://': 'https://'}) so you won't map https:// to httpss:// Nov 3 '14 at 17:36

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.