libreria-astro-lefebvre 0.1.31 → 0.1.32
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
|
@@ -9,6 +9,16 @@ export const metadata: ComponentMetadata = {
|
|
|
9
9
|
priority: 1,
|
|
10
10
|
tags: ['contenido', 'card', 'grid', 'wrapper', 'imagen', 'autor'],
|
|
11
11
|
fields: [
|
|
12
|
+
{
|
|
13
|
+
name: 'etiquetaVisible',
|
|
14
|
+
type: 'select',
|
|
15
|
+
options: ['fecha', 'keywords'],
|
|
16
|
+
options_labels: ['Fecha', 'Keywords'],
|
|
17
|
+
mandatory: false,
|
|
18
|
+
label: 'Etiqueta visible en la card',
|
|
19
|
+
help: 'Qué se muestra como badge sobre el título de cada card: la fecha o las keywords. Los datos estructurados (JSON-LD) incluyen ambos siempre, independientemente de esta opción',
|
|
20
|
+
example_value: 'fecha'
|
|
21
|
+
},
|
|
12
22
|
{
|
|
13
23
|
name: 'items',
|
|
14
24
|
type: 'list',
|
|
@@ -21,10 +31,12 @@ export const metadata: ComponentMetadata = {
|
|
|
21
31
|
{ name: 'title', type: 'text', help: 'Título de la card (h3). Se muestra siempre; si se deja vacío, aparece el h3 vacío', label: 'Título', example_value: 'Automatización de contratos con GenIA-L' },
|
|
22
32
|
{ name: 'description', type: 'textArea', help: 'Descripción de la card. Se muestra siempre como párrafo; si se deja vacía, aparece el párrafo vacío', label: 'Descripción', example_value: 'Redacta borradores de contratos en segundos a partir de plantillas personalizables' },
|
|
23
33
|
{ name: 'link', type: 'text', help: 'URL de destino al hacer click en la card (toda la card es clicable). Si se deja vacío, apunta a "#" (no navega)', label: 'Url del enlace', example_value: '/genia-l/blog/automatizacion-contratos' },
|
|
24
|
-
{ name: '
|
|
34
|
+
{ name: 'fecha', type: 'text', help: 'Fecha (badge) que aparece sobre el título cuando "Etiqueta visible" es Fecha. Si se deja vacía, NO se muestra', label: 'Fecha (etiqueta)', example_value: '10 de enero de 2026' },
|
|
25
35
|
{ name: 'image', type: 'image', help: 'Imagen de la card (aparece en la parte superior). Se renderiza siempre; si se deja vacía aparece una imagen rota', label: 'Imagen', example_value: 'https://assets.lefebvre.es/media/img/preview-comp/comp-16-9.png' },
|
|
26
36
|
{ name: 'altImage', type: 'text', help: 'Texto alternativo de la imagen para accesibilidad', label: 'Alt de la imagen', example_value: 'Captura de la interfaz de GenIA-L generando un contrato automáticamente' },
|
|
27
|
-
{ name: 'author', type: 'text', help: 'Nombre del autor del contenido. Se muestra como "Por [nombre]" debajo de la descripción. Si se deja vacío, la línea de autor NO se muestra', label: 'Nombre del autor', example_value: 'María García López' }
|
|
37
|
+
{ name: 'author', type: 'text', help: 'Nombre del autor del contenido. Se muestra como "Por [nombre]" debajo de la descripción. Si se deja vacío, la línea de autor NO se muestra', label: 'Nombre del autor', example_value: 'María García López' },
|
|
38
|
+
{ name: 'datePublished', type: 'text', help: 'Fecha de publicación en formato ISO 8601 para los datos estructurados (JSON-LD datePublished). No se muestra visualmente. Ej: 2026-01-10T00:00:00.000Z', label: 'Fecha publicación (ISO)', example_value: '2026-01-10T00:00:00.000Z' },
|
|
39
|
+
{ name: 'keywords', type: 'text', help: 'Palabras clave reales para los datos estructurados (JSON-LD keywords), separadas por comas. Se muestran como badge si "Etiqueta visible" es Keywords', label: 'Keywords (SEO)', example_value: 'Legaltech, Contratos, IA' }
|
|
28
40
|
]
|
|
29
41
|
}
|
|
30
42
|
}
|
|
@@ -8,14 +8,17 @@ interface MontevideoItem {
|
|
|
8
8
|
image?: string;
|
|
9
9
|
altImage?: string;
|
|
10
10
|
title?: string;
|
|
11
|
-
|
|
11
|
+
fecha?: string; // etiqueta de fecha para mostrar (badge)
|
|
12
12
|
author?: string;
|
|
13
13
|
description?: string;
|
|
14
|
+
datePublished?: string; // ISO 8601, para JSON-LD
|
|
15
|
+
keywords?: string; // keywords reales, para JSON-LD y para etiqueta visual
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
const {
|
|
17
19
|
items = [],
|
|
18
|
-
|
|
20
|
+
etiquetaVisible = "fecha",
|
|
21
|
+
}: { items?: MontevideoItem[]; etiquetaVisible?: "fecha" | "keywords" } = Astro.props;
|
|
19
22
|
|
|
20
23
|
const escapeJson = (s = "") => String(s).replace(/<[^>]*>/g, '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/[\n\r\t]+/g, ' ');
|
|
21
24
|
|
|
@@ -33,8 +36,9 @@ const structuredData = `<script type="application/ld+json">
|
|
|
33
36
|
"description": "${escapeJson(item.description)}"${item.image ? `,
|
|
34
37
|
"image": "${escapeJson(extractImageUrl(item.image))}"` : ""}${item.link ? `,
|
|
35
38
|
"url": "${escapeJson(item.link)}"` : ""}${item.author ? `,
|
|
36
|
-
"author": { "@type": "Person", "name": "${escapeJson(item.author)}" }` : ""}${item.
|
|
37
|
-
"
|
|
39
|
+
"author": { "@type": "Person", "name": "${escapeJson(item.author)}" }` : ""}${item.datePublished ? `,
|
|
40
|
+
"datePublished": "${escapeJson(item.datePublished)}"` : ""}${item.keywords ? `,
|
|
41
|
+
"keywords": "${escapeJson(item.keywords)}"` : ""}
|
|
38
42
|
}
|
|
39
43
|
}`).join(',')}]
|
|
40
44
|
}
|
|
@@ -49,7 +53,7 @@ const structuredData = `<script type="application/ld+json">
|
|
|
49
53
|
image={item.image}
|
|
50
54
|
altImage={item.altImage}
|
|
51
55
|
title={item.title}
|
|
52
|
-
tag={item.
|
|
56
|
+
tag={etiquetaVisible === "keywords" ? item.keywords : item.fecha}
|
|
53
57
|
author={item.author}
|
|
54
58
|
description={item.description} />
|
|
55
59
|
|