Making a Static Site with OpenCms

This page will describe how to use OpenCMS to make a static site.

You must enter your server’s MAC address during installation. I never tried to enter a bogus one, so I do not know what would happen. There are about 19,537 steps during the import process. It takes about 10 minutes.

Make a new project. First make a root folder for your site. A good place is under “/sites”. Publish the offline project. Go to the Administration view. When you make a new project, you have to select a location on the virtual file system for the “Content | Resources” section. The root is good. Otherwise you will not be able to make a new folder. This eliminates all the other stuff on the menu.

In order to export the files, you need to set “Export” to “True” for the folder. Click on the folder icon, select “Advanced | Secure/Export”, and set Export to “True”. Publish the project for this to take effect. If you do this for a folder, this setting will be inherited by any new files and folders that you create under it.

To make a new page, you select the “New” icon along the top, and select “Page with free text” in the menu. When using the editor, you want to put the text into the “Body” element.

To export the site, you first must publish it using the “Publish” button on the Explorer view. Then you need to go to the “Administration” view, select “Database Management”, and select “Start Static Export”. As far as I know, you need to go through this every time you make a change in order for the changes to be reflected in your static export. The export step itself takes a few minutes.

After I export, I like to copy the files from my Tomcat directory to my Apache web server on my local machine to test the site out. Here is a bit of a script:

export WWW_ROOT=/var/www
export TOMCAT_ROOT=/zEKM/jarFiles/apache-tomcat-6.0.18
mkdir opencms
mkdir opencms/export
cd $WWW_ROOT/opencms/export ; cp -rvfp /zEKM/jarFiles/apache-tomcat-6.0.18/webapps/opencms/export/* .
cd $WWW_ROOT/opencms;
ln -s export/ opencms

The soft link above will need to be recreated on a server if you FTP the files somewhere else.

The file opencms/opencms/system/modules/org.opencms.frontend.templatetwo/resources/css/style.css did not export. Its export prop was set to false.

After that, it is pretty easy to make new folders and pages in your site.

  Image from Wikimedia, assumed allowed under Fair Use. Image from the Roman Vergil, a 5th century manuscript of poems by Virgil.