From e27318fc1d0ca7e1eb66b4d3c067fbe41c6818e4 Mon Sep 17 00:00:00 2001 From: Benjamin Webb <40066515+webb-ben@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:48:53 -0500 Subject: [PATCH] Respected linkrel from provider (#1868) --- pygeoapi/api/itemtypes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pygeoapi/api/itemtypes.py b/pygeoapi/api/itemtypes.py index 56477e6c1..0cd50be40 100644 --- a/pygeoapi/api/itemtypes.py +++ b/pygeoapi/api/itemtypes.py @@ -509,9 +509,12 @@ def get_collection_items( serialized_query_params += '=' serialized_query_params += urllib.parse.quote(str(v), safe=',') + if 'links' not in content: + content['links'] = [] + # TODO: translate titles uri = f'{api.get_collections_url()}/{dataset}/items' - content['links'] = [{ + content['links'].extend([{ 'type': 'application/geo+json', 'rel': request.get_linkrel(F_JSON), 'title': l10n.translate('This document as GeoJSON', request.locale), @@ -526,7 +529,7 @@ def get_collection_items( 'rel': request.get_linkrel(F_HTML), 'title': l10n.translate('This document as HTML', request.locale), 'href': f'{uri}?f={F_HTML}{serialized_query_params}' - }] + }]) if offset > 0: prev = max(0, offset - limit)