diff --git a/templates/index.html b/templates/index.html
index 92e8534..be59d9f 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -99,7 +99,7 @@
-
+
@@ -108,7 +108,7 @@
-
+
CV JAMR - {{.CurrentYear}}
@@ -375,6 +375,9 @@
}
});
+ // Track if URL originally had lang parameter
+ const urlHadLangParam = new URLSearchParams(window.location.search).has('lang');
+
function selectLanguage(lang) {
// Update button states
document.querySelectorAll('.language-selector .selector-btn').forEach(btn => {
@@ -389,10 +392,20 @@
indicator: '#loading'
});
- // Update URL
+ // Update URL only if it originally had lang parameter
const url = new URL(window.location);
- url.searchParams.set('lang', lang);
- window.history.pushState({}, '', url);
+ if (urlHadLangParam) {
+ url.searchParams.set('lang', lang);
+ window.history.pushState({}, '', url);
+
+ // Update logo and title links to include current language
+ document.getElementById('logoLink').href = `/?lang=${lang}`;
+ document.getElementById('titleLink').href = `/?lang=${lang}`;
+ } else {
+ // Keep URL clean, but update logo/title links to stay clean too
+ document.getElementById('logoLink').href = '/';
+ document.getElementById('titleLink').href = '/';
+ }
// Update html lang attribute
document.documentElement.lang = lang;
@@ -480,6 +493,13 @@
document.addEventListener('DOMContentLoaded', function() {
const paper = document.querySelector('.cv-paper');
+ // Initialize logo/title links based on whether URL has lang parameter
+ if (urlHadLangParam) {
+ const currentLang = new URLSearchParams(window.location.search).get('lang') || 'en';
+ document.getElementById('logoLink').href = `/?lang=${currentLang}`;
+ document.getElementById('titleLink').href = `/?lang=${currentLang}`;
+ }
+
// Restore CV length preference
const savedLength = localStorage.getItem('cv-length') || 'short';
if (savedLength === 'long') {