Custom environment variable to main assets folder I have a multilingual website which has a folder structure such as:

craft
assets
  js
  css
nl
fr


My goal is to link to the assets folder for my js en css files, but as I'm running a multilingual site I have set my config file to:

return array(
    'omitScriptNameInUrls' =&gt; true,

    'siteUrl' =&gt; array(
        'nl' =&gt; 'http://krycer.be/nl/',
        'fr' =&gt; 'http://krycer.be/fr/',
    ),
);


Which means that my {{ siteUrl }} is set to krycer.be/nl or krycer.be/fr
But my assets folder is one level higher.
I tried adding this code to the config.php:

'environmentVariables' =&gt; array(
    'baseUrl'  =&gt; 'http://krycer.be/',
),


and accessing it by using

{{ baseUrl }} or {{ craft.config.environmentVariables.baseUrl }}


But nothing seems to work. How can I create an abolute link to my assets folder?
The easiest way to do this would be to just use root-relative resource URLs:

&lt;link rel="stylesheet" type="text/css" href="/assets/css/styles.css"&gt;
&lt;script type="text/javascript src="/assets/js/scripts.js"&gt;&lt;/script&gt;


The only disadvantage of that is it makes your site slightly less portable – you wouldn’t be able to run it from a subdirectory on a web server without updating all your URLs in the templates.

So a better option would be to define a custom config variable that holds the value of your site’s base URL in craft/config/general.php;

return array(
    'omitScriptNameInUrls' =&gt; true,

    'siteUrl' =&gt; array(
        'nl' =&gt; 'http://krycer.be/nl/',
        'fr' =&gt; 'http://krycer.be/fr/',
    ),

    'baseUrl' =&gt; 'http://krycer.be/',
),


And then access that config setting from your templates via craft.config:

&lt;link rel="stylesheet" type="text/css" href="{{ craft.config.baseUrl }}assets/css/styles.css"&gt;
&lt;script type="text/javascript src="{{ craft.config.baseUrl }}assets/js/scripts.js"&gt;&lt;/script&gt;


Note that there’s no reason to place that custom config variable within the environmentVariables config setting. The top level of the config array will work just fine for this.