Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise template section into distinct example with a note about include #5124

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 24 additions & 4 deletions doc/en/user/source/community/ogc-api/features/index.rst
Expand Up @@ -172,16 +172,32 @@ To override an OGC API Features template:
* :download:`ogc/features/collections.ftl </../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/collections.ftl>`
* :download:`ogc/features/queryables.ftl </../../../../src/community/ogcapi/ogcapi-core/src/main/resources/org/geoserver/ogcapi/queryables.ftl>`
* :download:`ogc/features/functions.ftl </../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/functions.ftl>`

The above built-in examples are for GeoServer |release|, please check for any changes when upgrading GeoServer.

The templates for listing feature content are shared between OGC API services. To override a template used to list features:

#. Use the directory in the location you wish to override:

* :file:`GEOSERVER_DATA_DIR/templates`
* :file:`GEOSERVER_DATA_DIR/workspace/{workspace}`
* :file:`GEOSERVER_DATA_DIR/workspace/{workspace}/{datastore}`
* :file:`GEOSERVER_DATA_DIR/workspace/{workspace}/{datastore}/{featuretype}`
* :download:`ogc/features/landingPage.ftl </../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/landingPage.ftl>`

#. Create a file in this location, using the GeoServer |release| examples below:

* :download:`ogc/features/getfeature-complex-content.ftl </../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/getfeature-complex-content.ftl>`
* :download:`ogc/features/getfeature-content.ftl </../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/getfeature-content.ftl>`
* :download:`ogc/features/getfeature-empty.ftl </../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/getfeature-empty.ftl>`
* :download:`ogc/features/getfeature-footer.ftl </../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/getfeature-footer.ftl>`
* :download:`ogc/features/getfeature-header.ftl </../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/getfeature-header.ftl>`
* :download:`ogc/features/landingPage.ftl </../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/landingPage.ftl>`

The above built-in examples are for GeoServer |release|, please check for any changes when upgrading GeoServer.

#. As an example :file:`ogc/features/collections.ftl` is used to list published collection:

As an example customize how collections are listed:

#. The file :file:`ogc/features/collections.ftl` lists published collection:

.. literalinclude:: /../../../../src/community/ogcapi/ogcapi-features/src/main/resources/org/geoserver/ogcapi/features/collections.ftl

Expand All @@ -201,11 +217,15 @@ To override an OGC API Features template:
</#list>
<#include "common-footer.ftl">

#. Many templates are constructed using ``#include``, for example :file:`collection.ftl` above uses ``<#include "common-header.ftl">`` located next to :file:`collections.ftl`.

Presently each family of templates manages its own :file:`common-header.ftl` (as shown in the difference between :file:`ogc/features` service templates, and getfeature templates above).

#. A restart is required, as templates are cached.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is actually the case, I've been changing templates a lot without having to restart during development. Wondering if it's somehow context specific.

Everything other change looks ok.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if the template was not cached, I did not figure out what was happening.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Templates are cached through all GeoServer (the classic Freemarker ones for WMS have always been) and are listening to file changes. I cannot reproduce the issue you're trying to report in the docs. Can you confirm it's actually happening on your end? How does it happen?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jodygarnett mind, above I was not asking about a diagnosis, but about steps to reproduce.


.. figure:: img/template_override.png

template collections.ftl override applied
Template collections.ftl override applied

#. Language codes are appended for internationalization. For French create the file :file:`GEOSERVER_DATA_DIR/workspace/{workspace}/ogc/collections_fr.ftl` and translate contents:

Expand Down