AnsweredAssumed Answered

Markup directive in head.ftl haven't been processed

Question asked by webdesigner on Feb 3, 2013
Latest reply on Feb 4, 2013 by ddraper

as asked by Dave Drapper in the comment:

this topic is created.

1. Alfresco Version
I'm running Alfresco (Un upgrade to 4.1.2 is planed, but later)

2. Are you creating and deploying an extension module? (and are you sure it’s deployed successfully?)
Yes, all other <@markup> directives have been processed properly, only directives within of *.head.html don't work

3. Are you targeting the correct <@markup> elements and are you using the right actions?

Here my code (my extension are packaged into the JAR and copied to WEB-INF/lib by deployment):

1. Extension module in /alfresco/web-extension/site-data/extensions/my-extension.xml

            <id>My Share Extensions</id>

2. Patch in the CORE web script: /share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/comments/comments-list.get.head.ftl

<#include "../">
<!– Comments List –>
<@link rel="stylesheet" type="text/css" href="${page.url.context}/res/components/comments/comments-list.css" />
<@script type="text/javascript" src="${page.url.context}/res/components/comments/comments-list.js"></@script>
<!– PATCH START custom-includes –>
<@markup id="commnts-list-custom-includes">
<!– Patch end –>

3. Custom webscript extension in /alfresco/webscripts/my/extensions/comments/comments-list.get.head.ftl

<@markup id="commnts-list-custom-includes-impl" target="commnts-list-custom-includes" action="replace" scope="global">
   <@link rel="stylesheet" type="text/css" href="${page.url.context}/res/components/css/my-comments-list.css" />

After deploying to Alfresco generated HTML for comments-list component doesn't contain a custom include.

In Log I see this warning:
2013-02-03 06:47:01,002  WARN  [extensibility.impl.ExtensibilityModelImpl] [http-8080-exec-23] The 'replace' action was attempted to used when defining the base model by directive:ID: commnts-list-custom-includes-impl, ACTION:replace

And in generally (as improvement idea), I think this markup:

<@markup id="custom-includes">

would be very useful at the end of every *.head.ftl, because it's a very simple but flexible way to add own customisations to Share components, without patching the core files everywhere where this component is  included.

Best regards