fix: paste trực tiếp tọa độ vào kinh độ vĩ độ
This commit is contained in:
@@ -102,6 +102,52 @@ export const LandingPage: React.FC<LandingPageProps> = ({ onGoToSignup, onGoToMa
|
||||
}
|
||||
};
|
||||
|
||||
// Update Open Graph meta tags when public photos are fetched
|
||||
useEffect(() => {
|
||||
if (publicPhotos.length > 0) {
|
||||
const mainPhoto = publicPhotos[0];
|
||||
const photoUrl = mainPhoto.imageUrl || mainPhoto.originalUrl || '/background.avif';
|
||||
const photoTitle = mainPhoto.metadata?.title || 'Travel Planner - Khám phá chuyến đi tuyệt vời';
|
||||
const photoDescription = mainPhoto.metadata?.description || `Được chia sẻ bởi ${mainPhoto.uploader?.name || 'một thành viên'}. Khám phá những hành trình tuyệt vời trên Travel Planner.`;
|
||||
|
||||
// Update og:image
|
||||
let ogImage = document.querySelector('meta[property="og:image"]');
|
||||
if (!ogImage) {
|
||||
ogImage = document.createElement('meta');
|
||||
ogImage.setAttribute('property', 'og:image');
|
||||
document.head.appendChild(ogImage);
|
||||
}
|
||||
ogImage.setAttribute('content', `https://yotrip.labz.io.vn${photoUrl}`);
|
||||
|
||||
// Update og:title
|
||||
let ogTitle = document.querySelector('meta[property="og:title"]');
|
||||
if (!ogTitle) {
|
||||
ogTitle = document.createElement('meta');
|
||||
ogTitle.setAttribute('property', 'og:title');
|
||||
document.head.appendChild(ogTitle);
|
||||
}
|
||||
ogTitle.setAttribute('content', photoTitle);
|
||||
|
||||
// Update og:description
|
||||
let ogDescription = document.querySelector('meta[property="og:description"]');
|
||||
if (!ogDescription) {
|
||||
ogDescription = document.createElement('meta');
|
||||
ogDescription.setAttribute('property', 'og:description');
|
||||
document.head.appendChild(ogDescription);
|
||||
}
|
||||
ogDescription.setAttribute('content', photoDescription);
|
||||
|
||||
// Update twitter:image
|
||||
let twitterImage = document.querySelector('meta[name="twitter:image"]');
|
||||
if (!twitterImage) {
|
||||
twitterImage = document.createElement('meta');
|
||||
twitterImage.setAttribute('name', 'twitter:image');
|
||||
document.head.appendChild(twitterImage);
|
||||
}
|
||||
twitterImage.setAttribute('content', `https://yotrip.labz.io.vn${photoUrl}`);
|
||||
}
|
||||
}, [publicPhotos]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchPublicPhotos();
|
||||
fetchTrustedUsers();
|
||||
|
||||
Reference in New Issue
Block a user