mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
pagetitle for profile layer
This commit is contained in:
parent
4efa682b06
commit
aef05cb757
@ -49,7 +49,10 @@ export const Layer = (props: LayerProps) => {
|
|||||||
const item = Object.entries(leafletRefs).find(r => r[1].popup == e.popup)?.[1].item;
|
const item = Object.entries(leafletRefs).find(r => r[1].popup == e.popup)?.[1].item;
|
||||||
if (item?.layer?.name == props.name && window.location.pathname.split("/")[2] != item.id) {
|
if (item?.layer?.name == props.name && window.location.pathname.split("/")[2] != item.id) {
|
||||||
window.history.pushState({}, "", `/${props.name}/${item.id}`)
|
window.history.pushState({}, "", `/${props.name}/${item.id}`)
|
||||||
document.title = document.title.split("-")[0] + " - " + item.name;
|
let title = "";
|
||||||
|
if(item.name) title = item.name;
|
||||||
|
else if (item.layer?.itemTitleField) title = getValue(item, item.layer.itemTitleField);
|
||||||
|
document.title = `${document.title.split("-")[0]} - ${title}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -69,7 +72,10 @@ export const Layer = (props: LayerProps) => {
|
|||||||
marker.openPopup();
|
marker.openPopup();
|
||||||
});
|
});
|
||||||
const item = leafletRefs[id]?.item;
|
const item = leafletRefs[id]?.item;
|
||||||
document.title = document.title.split("-")[0] + " - " + item.name;
|
let title = "";
|
||||||
|
if(item.name) title = item.name;
|
||||||
|
else if (item.layer?.itemTitleField) title = getValue(item, item.layer.itemTitleField);
|
||||||
|
document.title = `${document.title.split("-")[0]} - ${title}`;
|
||||||
document.querySelector('meta[property="og:title"]')?.setAttribute("content", item.name);
|
document.querySelector('meta[property="og:title"]')?.setAttribute("content", item.name);
|
||||||
document.querySelector('meta[property="og:description"]')?.setAttribute("content", item.text);
|
document.querySelector('meta[property="og:description"]')?.setAttribute("content", item.text);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user