-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
101 lines (88 loc) · 3.18 KB
/
index.html
File metadata and controls
101 lines (88 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MN - Full‑Stack Web Developer | Language Redirect</title>
<meta name="description" content="Full‑Stack Web Developer - Redirecting to your preferred language version.">
<meta name="robots" content="index, follow">
<!-- Prevent Flash Bang - Set Theme Before Page Loads -->
<script>
(function() {
const savedTheme = localStorage.getItem('theme');
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const theme = savedTheme || (prefersDark ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', theme);
})();
</script>
<!-- Language Detection and Redirect -->
<script>
// Function to detect browser language and redirect accordingly
function detectLanguageAndRedirect() {
// Get browser language (primary language)
const browserLang = navigator.language || navigator.userLanguage;
const primaryLang = browserLang.split('-')[0].toLowerCase();
// Check if language is Bulgarian
if (primaryLang === 'bg' || primaryLang === 'bul') {
// Redirect to Bulgarian version
window.location.replace('/bg/');
} else {
// Redirect to English version for all other languages
window.location.replace('/en/');
}
}
// Execute redirect after theme is applied
setTimeout(detectLanguageAndRedirect, 100);
</script>
<!-- Fallback for users with JavaScript disabled - will redirect to English by default -->
<meta http-equiv="refresh" content="1; url=/en/">
<!-- Canonical URL -->
<link rel="canonical" href="https://sn1wfy.net/en/">
<!-- Hreflang for language switching -->
<link rel="alternate" hreflang="en" href="https://sn1wfy.net/en/">
<link rel="alternate" hreflang="bg" href="https://sn1wfy.net/bg/">
<link rel="alternate" hreflang="x-default" href="https://sn1wfy.net/en/">
<!-- Basic styling to prevent flash -->
<style>
body {
margin: 0;
padding: 0;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background-color: var(--bg-primary, #ffffff);
color: var(--text-primary, #1f2937);
transition: background-color 0.4s ease, color 0.4s ease;
}
[data-theme="dark"] {
--bg-primary: #0f172a;
--text-primary: #f1f5f9;
}
.redirect-container {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
}
.redirect-message {
font-size: 1.2rem;
margin-bottom: 1rem;
}
.redirect-link {
color: #3b82f6;
text-decoration: none;
font-weight: 600;
}
.redirect-link:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="redirect-container">
<div>
<div class="redirect-message">Redirecting to your preferred language...</div>
<a href="/en/" class="redirect-link" onclick="window.location.href='/en/'">Click here if you are not redirected automatically</a>
</div>
</div>
</body>
</html>