diff --git a/pygeoapi/templates/item.html b/pygeoapi/templates/item.html index 10695bb..6c3c596 100644 --- a/pygeoapi/templates/item.html +++ b/pygeoapi/templates/item.html @@ -1,4 +1,17 @@ {% extends "base.html" %} +{# Optionally renders an img element, otherwise standard value or link rendering #} +{% macro render_item_value(v, width) -%} + {% set val = v | string | trim | lower %} + {% if val|length and + (val.endswith(".jpg") or val.endswith(".jpeg") or val.endswith(".png") or val.endswith(".gif") or val.endswith(".bmp")) + %} + {# Ends with image extension: render img element with link to image #} + + {% else %} + {# All other cases: text or link value #} + {{ v | urlize() }} + {% endif %} +{%- endmacro %} {% block title %}{{ super() }} {{ data['title'] }} {% endblock %} {% block crumbs %}{{ super() }} / Collections @@ -52,7 +65,7 @@ {% else %} - {{ v | urlize(25) }} + {{ render_item_value(v, 80) }} {% endif %} {% endfor %}