I am using GeoServer for creating two web map applications. Under the GeoServer data directory, I have changed the content.ftl files for the use of my first map application. Now I am building the second map app, and would like to apply a different template to it.

Is it possible to define different templates for the two map applications?

  • I think that each feature can have one (and only) one template. Could you copy the layer? – Ian Turton Jul 12 '13 at 8:18
  • Yes, The two maps will be using different layers. The problem is solved. Thanks! – K Hsueh Jul 13 '13 at 13:00

Yes you can have multiple templates in your data directory. They just need to be in separate directories.

Have a look at the Template Lookup

Geoserver looks up templates in three different places, allowing for various level of customization. For example given the content.ftl template used to generate WMS GetFeatureInfo content:

 - Look into GEOSERVER_DATA_DIR/workspaces/<workspace>/<datastore>/<featuretype>/content.ftl to see if there is a feature type specific template
 - Look into GEOSERVER_DATA_DIR/workspaces/<workspace>/<datastore>/content.ftl to see if there is a store specific template
 - Look into GEOSERVER_DATA_DIR/workspaces/<workspace>/content.ftl to see if there is a workspace specific template
 - Look into GEOSERVER_DATA_DIR/workspaces/content.ftl looking for a global override
 - Look into GEOSERVER_DATA_DIR/templates/content.ftl looking for a global override
 - Look into the GeoServer classpath and load the default template

So You could have two workspaces, one for each webgis, and then place the appropriate template in the correct workspace folder.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.