1

I am using {{ siteUrl }} for absolute links. It works 95% of the time. But if I press the reload button multiple times in a few seconds (overloading or something) my links look like this:

href="$DEFAULT_SITE_URL/css/order.css" 

instead of

href="http://localhost/craft/web/css/order.css"

other Twig commands are working fine at the same time. What's happening?

2

Try using {{ currentSite.baseUrl }}

I had the same issue when I started using environment variables instead of @web for my sites. I've found the above works for all cases.

| improve this answer | |

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.