diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst
index 3735bda..ee2de85 100644
--- a/docs/source/configuration.rst
+++ b/docs/source/configuration.rst
@@ -175,7 +175,8 @@ default.
name: CSV
data: tests/data/obs.csv # required: the data filesystem path or URL, depending on plugin setup
id_field: id # required for vector data, the field corresponding to the ID
- time_field: datetimestamp # optional field corresponding to the temporal propert of the dataset
+ time_field: datetimestamp # optional field corresponding to the temporal property of the dataset
+ title_field: foo # optional field of which property to display as title/label on HTML pages
format: # optional default format
name: GeoJSON # required: format name
mimetype: application/json # required: format mimetype
diff --git a/pygeoapi-config.yml b/pygeoapi-config.yml
index 5eb7bc6..b493393 100644
--- a/pygeoapi-config.yml
+++ b/pygeoapi-config.yml
@@ -151,6 +151,7 @@ resources:
name: GeoJSON
data: tests/data/ne_110m_lakes.geojson
id_field: id
+ title_field: name
gdps-temperature:
type: collection
diff --git a/pygeoapi/api.py b/pygeoapi/api.py
index 18e8e71..bb5dd6b 100644
--- a/pygeoapi/api.py
+++ b/pygeoapi/api.py
@@ -837,6 +837,7 @@ class API:
return headers_, 400, to_json(exception, self.pretty_print)
LOGGER.debug('Loading provider')
+
try:
p = load_plugin('provider', get_provider_by_type(
collections[dataset]['providers'], 'feature'))
@@ -1053,6 +1054,11 @@ class API:
content['dataset_path'] = '/'.join(path_info.split('/')[:-1])
content['collections_path'] = '/'.join(path_info.split('/')[:-2])
content['startindex'] = startindex
+ prv = get_provider_by_type(collections[dataset]['providers'],
+ 'feature')
+ if 'title_field' in prv:
+ content['title_field'] = prv['title_field']
+ content['id_field'] = prv['id_field']
content = render_j2_template(self.config,
'collections/items/index.html',
@@ -1120,6 +1126,7 @@ class API:
return headers_, 400, to_json(exception, self.pretty_print)
LOGGER.debug('Loading provider')
+
try:
p = load_plugin('provider', get_provider_by_type(
collections[dataset]['providers'], 'feature'))
@@ -1211,6 +1218,12 @@ class API:
headers_['Content-Type'] = 'text/html'
content['title'] = collections[dataset]['title']
+ prv = get_provider_by_type(collections[dataset]['providers'],
+ 'feature')
+ content['id_field'] = prv['id_field']
+ if 'title_field' in prv:
+ content['title_field'] = prv['title_field']
+
content = render_j2_template(self.config,
'collections/items/item.html',
content)
diff --git a/pygeoapi/templates/collections/items/index.html b/pygeoapi/templates/collections/items/index.html
index e55bbb1..97ffbcf 100644
--- a/pygeoapi/templates/collections/items/index.html
+++ b/pygeoapi/templates/collections/items/index.html
@@ -74,10 +74,14 @@
@@ -85,11 +89,14 @@
{% for ft in data['features'] %}
id
- {% for k, v in data['features'][0]['properties'].items() %}
- {% if loop.index < 5 %}
- {{ k }}
+ {% if data['title_field'] %}
+ {{ data['title_field'] }}
{% endif %}
+ {% for k, v in data['features'][0]['properties'].items() %}
+ {# start with id & title then take first 5 columns for table #}
+ {% if loop.index < 5 and k != data['id_field'] and k != data['title_field'] %}
+ {{ k }}
+ {% endif %}
{% endfor %}