mirror of
https://github.com/mvvasilev/findtheti.me.git
synced 2025-04-19 13:39:52 +03:00
Dynamic link preview
This commit is contained in:
parent
1ac5eb21f4
commit
f25546e830
1 changed files with 18 additions and 0 deletions
|
@ -91,6 +91,24 @@ export default function ExistingEventPage() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.title = `findtheti.me - ${event.name}`;
|
document.title = `findtheti.me - ${event.name}`;
|
||||||
|
|
||||||
|
const ogTitleMeta = document.querySelector('meta[property="og:title"]');
|
||||||
|
const ogUrlMeta = document.querySelector('meta[property="og:url"]');
|
||||||
|
const ogDescriptionMeta = document.querySelector('meta[property="og:description"]');
|
||||||
|
|
||||||
|
// Update the content of the Open Graph meta tags
|
||||||
|
if (ogTitleMeta) {
|
||||||
|
ogTitleMeta.setAttribute('content', `findtheti.me - ${event.name}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ogDescriptionMeta) {
|
||||||
|
ogDescriptionMeta.setAttribute('content', `${event.description || 'A simple to use scheduling assistant'}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ogUrlMeta) {
|
||||||
|
ogUrlMeta.setAttribute('content', `${window.location.origin}/${eventId}`)
|
||||||
|
}
|
||||||
|
|
||||||
}, [event])
|
}, [event])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue