From 8952c79f330acd5ccc9ade586c0d880adec3543d Mon Sep 17 00:00:00 2001 From: mashehu Date: Mon, 13 Jan 2025 14:25:46 +0100 Subject: [PATCH] filter our index page in map --- sites/main-site/src/components/event/EventMap.astro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sites/main-site/src/components/event/EventMap.astro b/sites/main-site/src/components/event/EventMap.astro index 3715ac6285..1b03662614 100644 --- a/sites/main-site/src/components/event/EventMap.astro +++ b/sites/main-site/src/components/event/EventMap.astro @@ -8,13 +8,13 @@ let events = await getCollection('events', ({ slug }) => { return slug.startsWith(event); }); -const local_sites_map: { +let local_sites_map: { location: [number, number]; name: string; url: string; }[] = events.map((site) => { const location = site.data.locations?.[0]; - if (location) { + if (location && location.geoCoordinates) { return { location: location.geoCoordinates, name: site.data.title, @@ -23,6 +23,8 @@ const local_sites_map: { } return null; }); +// remove null values +local_sites_map = local_sites_map.filter((site) => site !== null); ---