How add js scripts to head tag


We are trying to integrate Exhibit to a Nuxeo application.

Unfortunately, they need to add some scripts and other things exactly to the head tag of the HTML document.

Can you, please, give some info how this can be done. We don't need this for all pages - just for a few.


1 votes

1 answers




You have several options, some of them are only available in recent versions of Nuxeo.

If you'd like to do this just for a few pages, you can insert links in the xhtml template using a slot that was made available since 5.4.2:

<ui:define name="header_scripts">
  <script type="text/javascript" src="#{baseURL}scripts/jquery/jquery.hotkeys.js"></script>

See for details.

When using earlier versions, you can also contribute your resources to the theme view fragments (if you'd like the scripts to be available on all pages), for instance by adding your resources to the “nuxeo5 includes” fragment used in the Nuxeo default theme:

<component name="org.nuxeo.theme.myCustomContrib">
  <extension target="" point="views">
    <view name="nuxeo5 includes" template-engine="jsf-facelets" merge="true">
  <extension target="" point="resources">
    <resource name="jquery.hotkeys.js">

You do not have to name the resource like the file, but keeping the extension “.js” is important.

If you only have some custom JS functions to add to all pages, you can also override the file at nuxeo.war/scripts/custom-javascript.js that is an empty placeholder in the default application.

Note that we're currently making improvements to make theme resources management more modular (see, so we'll probably advertise new ways of doing so from the 5.5. version (but options i gave above will be kept for compatibility).

Update since 5.5 release: see documentation available at

1 votes