For Developers

Article using headinclude tag.

Please click the button to refresh the date.

In OpenCms 9 you can include additional javascript or CSS files required for the specific resource type. The paths to the additional files have to be set in its XSD. The referenced files are loaded dynamically, if an element of that resource type is dropped into the container page.

To include the javascript or CSS files follow the instructions:

  • Reference the javascript or css files inside of the resource type scheme using <headinclude> node.

Please look up:

/system/modules/com.alkacon.bootstrap.dev.demo/schemas/article_with_headincludes.xsd

  • Extend the template JSP by adding the following lines:
    • <cms:headincludes type="javascript" />
    • <cms:headincludes type="css" />
  • Now you can access the additional javascript and CSS inside the formatter.