Article using headinclude tag.

Please click the button to refresh the date.



In OpenCms 8 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 compare:

/system/modules/org.opencms.dev.demo/schemas/article_with_headincludes.xsd

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