diff --git a/pygeoapi/templates/collections/items/index.html b/pygeoapi/templates/collections/items/index.html
index 746cc5e..390b5c4 100644
--- a/pygeoapi/templates/collections/items/index.html
+++ b/pygeoapi/templates/collections/items/index.html
@@ -125,7 +125,7 @@
var items = new L.GeoJSON(geojson_data, {
onEachFeature: function (feature, layer) {
var url = '{{ data['items_path'] }}/' + feature.id + '?f=html';
- var html = '' + feature.id + '. ' + feature['properties']['{{ data['title_field'] }}'] + '';
+ var html = '' + {% if data['title_field'] %} feature['properties']['{{ data['title_field'] }}'] {% else %} feature.id {% endif %} + '';
layer.bindPopup(html);
}
});
diff --git a/pygeoapi/templates/collections/items/item.html b/pygeoapi/templates/collections/items/item.html
index 404a3de..1fb5f74 100644
--- a/pygeoapi/templates/collections/items/item.html
+++ b/pygeoapi/templates/collections/items/item.html
@@ -1,5 +1,5 @@
{% extends "_base.html" %}
-{% set ptitle = data['properties'][data['title_field']] or ("Item " + data['id']) %}
+{% set ptitle = data['properties'][data['title_field']] or ("Item {}".format(data['id'])) %}
{# Optionally renders an img element, otherwise standard value or link rendering #}
{% macro render_item_value(v, width) -%}
{% set val = v | string | trim %}