libreria-astro-lefebvre 0.1.21 → 0.1.22
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.
package/package.json
CHANGED
|
@@ -18,8 +18,13 @@ const {
|
|
|
18
18
|
subdirectory = '',
|
|
19
19
|
loading = 'eager' as 'lazy' | 'eager',
|
|
20
20
|
categories: categoriesProp = undefined as MenuItem[] | undefined,
|
|
21
|
+
siteUrl = '' as string,
|
|
21
22
|
} = Astro.props;
|
|
22
23
|
|
|
24
|
+
// Origen absoluto para el JSON-LD de navegación. En SSR tras un proxy, Astro.url resuelve al
|
|
25
|
+
// host interno (localhost), así que se prioriza `siteUrl` (prop) y `Astro.site` (config).
|
|
26
|
+
const origin = (siteUrl || Astro.site?.href || Astro.url.origin).replace(/\/+$/, '');
|
|
27
|
+
|
|
23
28
|
const FALLBACK_CATEGORIES = [
|
|
24
29
|
{
|
|
25
30
|
name: 'Cómo funciona',
|
|
@@ -70,11 +75,11 @@ const categories: MenuItem[] = (categoriesProp && categoriesProp.length > 0)
|
|
|
70
75
|
"@context": "https://schema.org",
|
|
71
76
|
"@type": "SiteNavigationElement",
|
|
72
77
|
"name": "Main Navigation",
|
|
73
|
-
"url": "${
|
|
78
|
+
"url": "${origin}${subdirectory}",
|
|
74
79
|
"hasPart": [${categories.map(category => `{
|
|
75
80
|
"@type": "SiteNavigationElement",
|
|
76
81
|
"name": "${category.name}",
|
|
77
|
-
"url": "${
|
|
82
|
+
"url": "${origin}${category.link}"
|
|
78
83
|
}`).join(',')}]
|
|
79
84
|
}
|
|
80
85
|
</script>`;
|