@yatoday/astro-ui 0.17.9 → 0.17.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,18 +39,19 @@ const locale = urlParts[0] && supportedLocales.includes(urlParts[0]) ? urlParts[
|
|
|
39
39
|
// Build alternate locale links for hreflang (including self-reference)
|
|
40
40
|
// Use alternateUrls if provided (for blog posts with different slugs per language)
|
|
41
41
|
// Otherwise, use path-based replacement for static pages
|
|
42
|
+
// When alternateUrls is provided, ONLY include languages that have a URL (no fallback)
|
|
42
43
|
const alternateLocales = alternateUrls
|
|
43
44
|
? supportedLocales
|
|
45
|
+
.filter((lang) => alternateUrls[lang]) // Only include languages with actual URLs
|
|
44
46
|
.map((lang) => ({
|
|
45
47
|
locale: lang,
|
|
46
|
-
url: alternateUrls[lang]
|
|
48
|
+
url: alternateUrls[lang],
|
|
47
49
|
}))
|
|
48
|
-
.concat(
|
|
49
|
-
|
|
50
|
-
locale: 'x-default',
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
])
|
|
50
|
+
.concat(
|
|
51
|
+
alternateUrls[defaultLocale]
|
|
52
|
+
? [{ locale: 'x-default', url: alternateUrls[defaultLocale] }]
|
|
53
|
+
: []
|
|
54
|
+
)
|
|
54
55
|
: supportedLocales
|
|
55
56
|
.map((lang) => {
|
|
56
57
|
// Replace current locale with target locale and ensure trailing slash
|