Up till now, all my craft sites were single language. When including CSS and JS files from web folder, i used to use {{siteUrl}} variable, like this:

<script src='{{siteUrl}}/plugins/jquery.js'></script>

Such path was rendered to this:

<script src='http://website.com/plugins/jquery.js'></script>

Unfortunetly, on multilanguage websites, where different languages have different url path (site.com and site.com/en), {{siteUrl}} variable changes and paths to these files are incorrectly rendered, like this:

<script src='http://website.com/en/plugins/jquery.js'></script>

What variable can i use that will give me path to web folder - regardless of currently used language?


Use the alias instead {{ alias('@web') }}

It will always point to your web directory


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.