OpenCms Static-Export Advanced Features

The advanced features of the Static Export are:

  • Real File System Rules (general improvement)
    Until now, you could specify a set of settings for the static export, like <rfs-prefix>, <exportpath> and <userelativelinks>, which were global settings and you had no possibility to have different settings for different resource sets. The idea of the rfs-rules is to complement this global settings, being able to specify different settings for different resource sets.
  • Export Rules (AfterPublish/Full static export specific new feature)
    An export rule let you specify a set of resources to export if a modified resource matches a set of rules. And the main idea behind it, is to optimize the needed time used to do an static export after publish. Until now, every time a resource has been published, OpenCms mades a static export of all resources in the vfs! (at least all resources matched by the <regex> patterns in the <resourcetorender> node) since there was no possibility to know the dependencies of a file. So, this new feature lets OpenCms know which are the dependencies of a set of resources.
  • Tutorial
    Learn how to begin using these new features.

This new features as also all the other configuration settings for the Static Export should be given in the ${CONTEXT_NAME}/WEB-INF/config/opencms-importexport.xml configuration file.

Some general issues you have to be aware of when static exporting a site:

  • No form of dynamic interaction with the user can be static exported, like contact forms or search functions. If need such functionallity use an hibrid solution with the On-Demand export feature, how to use this feature is detailed in the com.alkacon.documentation.howto_httpd_tomcat_modproxy documentation module.
  • Dinamic pages and resources, i.e. JSP pages with parameters for generating images, or style sheets, or what ever, can be statically exported using the CmsJspActionElement.link(String) method or the <cms:link> tag given to it the whole path with all parameters, when referencing it. For instance:
    new CmsJspActionElement.link(pageContext, request,response).link("/system/modules/mytemplate/style.css?param1=value1&param2=value2")
    And things like:
    new CmsJspActionElement.link(pageContext, request, response).link("/system/modules/mytemplate/style.css") + "?param1=value1&param2=value2"
    will not work, because the parameters are not encoded.
  • You will also have troubles when using javascript to display pages, because you have no access to the CmsJspActionElement.link(String) method, so do not do that.
  • Be also sure the Export user had at least permission to read the resources to export.
  • Do not forget to configure your export url correctly, it should be something like http://127.0.0.1:8080/${CONTEXT_NAME}/handle404.
  • You can also mark a resource as internal so it will not be exported, this can be done in the Secure/Export dialog.
  • In apache is important to configure the DirectoryIndex option so that the index_export.html files are also view as default directory content.