X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/84c511aaea6efd311518f97fcfd301569e247130..7218a0c36c5b1e28ed46e1e1b133b5e5dd68b2ca:/src/pages/DetailsPage.svelte

diff --git a/src/pages/DetailsPage.svelte b/src/pages/DetailsPage.svelte
index baac180..2c7f8ba 100644
--- a/src/pages/DetailsPage.svelte
+++ b/src/pages/DetailsPage.svelte
@@ -54,6 +54,14 @@
     }
   }
 
+  function place_has_keywords(aThisPlace) {
+    // Return false if Nominatim API sends 'keywords: { name: [], address: [] }'
+    return (
+      aThisPlace.keywords && aThisPlace.keywords.name && aThisPlace.keywords.address
+      && (aThisPlace.keywords.name.length > 0 || aThisPlace.keywords.address.length > 0)
+    );
+  }
+
   $: {
     let pageinfo = $page;
     if (pageinfo.tab === 'details') {
@@ -165,7 +173,7 @@
             <tr class="all-columns"><td colspan="6"><h2>Keywords</h2></td></tr>
             {#if api_request_params.keywords}
 
-              {#if aPlace.keywords && (aPlace.keywords.name || aPlace.keywords.address) }
+              {#if place_has_keywords(aPlace)}
                 <tr class="all-columns"><td colspan="6"><h3>Name Keywords</h3></td></tr>
                 {#each aPlace.keywords.name as keyword}
                   <tr>
