cancel
Showing results for 
Search instead for 
Did you mean: 

Surf extension for head-resources

loftux
Star Contributor
Star Contributor
I'm trying to add an additional resource to head to load a web-fonts. So it needs to be generic for all places. For that I wanted to add to global.head-resources.xml to load this additional resouce.
This is what I have tried
<extension>
   <modules>
      <module>
         <id>LoftuxResources</id>
         <description>Additional resources loaded in header</description>
         <components>
            <component>
               <scope>global</scope>
               <region-id>head-resources</region-id>
               <source-id>global</source-id>
               <sub-components>
                  <sub-component id="load-webfonts">
                     <url>/loftux/head</url>
                  </sub-component>
               </sub-components>
            </component>
         </components>
      </module>
   </modules>
</extension>
It doesn't load anything (yes I have deployed the modul). Is this the right approach?
In my webscript /loftux/head I just have
<@link href='http://fonts.googleapis.com/css?family=Belleza' rel='stylesheet' type='text/css'/>
Also tried without the @-char.
resources.get.html.ftl have a markup that implies there should maybe this should be done in another way
<@markup id="resources">
   <#– Use this "markup id" to add in a extension's resources –>
</@>
1 REPLY 1

ddraper
World-Class Innovator
World-Class Innovator
For these types of global imports it would definitely be best to use that <@markup> directive. If you're working off the latest community source then you need to be aware that it's in a state of transition and that the <@link> and <@script> directives will not work when used in .head.ftl files any more (this is because the macros used in 4.0.x and earlier have been replaced with custom Surf directives)