optimize search engine
This commit is contained in:
1 parent
f5159100f7
commit
ac8c63d790
2 files changed
+133
-10
No files matched your search
+46
-8
@@ -4,13 +4,20 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title data-i18n="page_title">Nha Trang — Thiên đường du lịch biển Việt Nam | 芽庄 | Nha Trang | Нячанг</title>
|
||||
<meta name="description" content="Khám phá Nha Trang: các điểm tham quan nổi bật, thời tiết theo mùa, ẩm thực địa phương và tour du lịch.">
|
||||
<link rel="canonical" href="https://kyduyen.duckdns.org/">
|
||||
<meta id="meta-description" name="description" content="Khám phá Nha Trang: điểm tham quan, thời tiết, ẩm thực địa phương và tour du lịch.">
|
||||
<link id="canonical-url" rel="canonical" href="https://kyduyen.duckdns.org/?lang=vi">
|
||||
<link rel="alternate" hreflang="vi" href="https://kyduyen.duckdns.org/?lang=vi">
|
||||
<link rel="alternate" hreflang="ru" href="https://kyduyen.duckdns.org/?lang=ru">
|
||||
<link rel="alternate" hreflang="en" href="https://kyduyen.duckdns.org/?lang=en">
|
||||
<link rel="alternate" hreflang="zh" href="https://kyduyen.duckdns.org/?lang=zh">
|
||||
<link rel="alternate" hreflang="de" href="https://kyduyen.duckdns.org/?lang=de">
|
||||
<link rel="alternate" hreflang="fr" href="https://kyduyen.duckdns.org/?lang=fr">
|
||||
<link rel="alternate" hreflang="x-default" href="https://kyduyen.duckdns.org/?lang=vi">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="Nha Trang — Cẩm nang du lịch">
|
||||
<meta property="og:description" content="Khám phá điểm đến, thời tiết, ẩm thực và trải nghiệm tại Nha Trang, Việt Nam.">
|
||||
<meta property="og:url" content="https://kyduyen.duckdns.org/">
|
||||
<meta property="og:locale" content="vi_VN">
|
||||
<meta id="og-title" property="og:title" content="Nha Trang — Thiên đường du lịch biển Việt Nam">
|
||||
<meta id="og-description" property="og:description" content="Khám phá Nha Trang: điểm tham quan, thời tiết, ẩm thực địa phương và tour du lịch.">
|
||||
<meta id="og-url" property="og:url" content="https://kyduyen.duckdns.org/?lang=vi">
|
||||
<meta id="og-locale" property="og:locale" content="vi_VN">
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
@@ -436,6 +443,7 @@
|
||||
const translations = {
|
||||
vi: {
|
||||
page_title: "Nha Trang — Thiên đường du lịch biển Việt Nam",
|
||||
meta_description: "Khám phá Nha Trang: điểm tham quan, thời tiết, ẩm thực địa phương và tour du lịch.",
|
||||
logo_sub: "Paradise Bay",
|
||||
nav_about: "Về Nha Trang",
|
||||
nav_attractions: "Điểm đến",
|
||||
@@ -525,6 +533,7 @@
|
||||
},
|
||||
ru: {
|
||||
page_title: "Нячанг — Жемчужина Вьетнама",
|
||||
meta_description: "Откройте для себя Нячанг: достопримечательности, погода, местная кухня и экскурсии.",
|
||||
logo_sub: "Paradise Bay",
|
||||
nav_about: "О Нячанге",
|
||||
nav_attractions: "Достопримечательности",
|
||||
@@ -614,6 +623,7 @@
|
||||
},
|
||||
en: {
|
||||
page_title: "Nha Trang — Vietnam's Coastal Paradise",
|
||||
meta_description: "Explore Nha Trang, Vietnam: top attractions, local weather, cuisine, and tours.",
|
||||
logo_sub: "Paradise Bay",
|
||||
nav_about: "About",
|
||||
nav_attractions: "Attractions",
|
||||
@@ -703,6 +713,7 @@
|
||||
},
|
||||
zh: {
|
||||
page_title: "芽庄 — 越南海滨度假天堂",
|
||||
meta_description: "探索越南芽庄:热门景点、天气、当地美食与旅游体验。",
|
||||
logo_sub: "Paradise Bay",
|
||||
nav_about: "关于芽庄",
|
||||
nav_attractions: "热门景点",
|
||||
@@ -792,6 +803,7 @@
|
||||
},
|
||||
de: {
|
||||
page_title: "Nha Trang — Vietnams Küstenparadies",
|
||||
meta_description: "Entdecken Sie Nha Trang: Sehenswürdigkeiten, Wetter, lokale Küche und Ausflüge.",
|
||||
logo_sub: "Paradiesische Bucht",
|
||||
nav_about: "Über Nha Trang",
|
||||
nav_attractions: "Sehenswürdigkeiten",
|
||||
@@ -881,6 +893,7 @@
|
||||
},
|
||||
fr: {
|
||||
page_title: "Nha Trang — Le paradis côtier du Vietnam",
|
||||
meta_description: "Découvrez Nha Trang : sites incontournables, météo, cuisine locale et excursions.",
|
||||
logo_sub: "Baie paradisiaque",
|
||||
nav_about: "À propos de Nha Trang",
|
||||
nav_attractions: "Sites à découvrir",
|
||||
@@ -970,6 +983,15 @@
|
||||
}
|
||||
};
|
||||
|
||||
const languageLocales = {
|
||||
vi: 'vi_VN',
|
||||
ru: 'ru_RU',
|
||||
en: 'en_US',
|
||||
zh: 'zh_CN',
|
||||
de: 'de_DE',
|
||||
fr: 'fr_FR'
|
||||
};
|
||||
|
||||
let currentLang = 'vi';
|
||||
let currentWeatherCondition = 'weather_loading';
|
||||
|
||||
@@ -1028,7 +1050,13 @@
|
||||
return 'vi';
|
||||
}
|
||||
|
||||
function getRequestedLanguage() {
|
||||
const requested = new URLSearchParams(window.location.search).get('lang');
|
||||
return translations[requested] ? requested : null;
|
||||
}
|
||||
|
||||
function setLanguage(lang) {
|
||||
if (!translations[lang]) lang = 'vi';
|
||||
currentLang = lang;
|
||||
document.querySelectorAll('[data-i18n]').forEach(el => {
|
||||
const key = el.getAttribute('data-i18n');
|
||||
@@ -1051,6 +1079,17 @@
|
||||
});
|
||||
|
||||
document.documentElement.lang = lang;
|
||||
const languageUrl = new URL(window.location.href);
|
||||
languageUrl.searchParams.set('lang', lang);
|
||||
history.replaceState(null, '', `${languageUrl.pathname}${languageUrl.search}${languageUrl.hash}`);
|
||||
|
||||
const canonicalUrl = new URL(`/?lang=${lang}`, window.location.origin).href;
|
||||
document.getElementById('canonical-url').href = canonicalUrl;
|
||||
document.getElementById('meta-description').content = translations[lang].meta_description;
|
||||
document.getElementById('og-title').content = translations[lang].page_title;
|
||||
document.getElementById('og-description').content = translations[lang].meta_description;
|
||||
document.getElementById('og-url').content = canonicalUrl;
|
||||
document.getElementById('og-locale').content = languageLocales[lang];
|
||||
renderWeatherCondition();
|
||||
}
|
||||
|
||||
@@ -1104,8 +1143,7 @@
|
||||
document.getElementById('success-modal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// Initialize from browser language preferences
|
||||
setLanguage(getPreferredLanguage());
|
||||
setLanguage(getRequestedLanguage() || getPreferredLanguage());
|
||||
loadCurrentWeather();
|
||||
setInterval(loadCurrentWeather, 30 * 60 * 1000);
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user