From a4f119cde567708cfb0d036972d8fbd7d363497c Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 14 Sep 2023 14:07:05 +0200 Subject: [PATCH] fix og-meta-tags --- src/Components/Map/Layer.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Components/Map/Layer.tsx b/src/Components/Map/Layer.tsx index d9998132..e4760bae 100644 --- a/src/Components/Map/Layer.tsx +++ b/src/Components/Map/Layer.tsx @@ -70,6 +70,10 @@ export const Layer = (props: LayerProps) => { marker !== null && props.clusterRef?.current?.zoomToShowLayer(marker, () => { marker.openPopup(); }); + const item = leafletRefs[id]?.item; + document.title = document.title.split("-")[0] + " - " + item.name; + document.querySelector('meta[property="og:title"]')?.setAttribute("content", item.name); + document.querySelector('meta[property="og:description"]')?.setAttribute("content", item.text); } } }