libreria-astro-lefebvre 0.1.31 → 0.1.33
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,26 @@ 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
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'showAutor',
|
|
24
|
+
type: 'select',
|
|
25
|
+
options: ['false', 'true'],
|
|
26
|
+
options_labels: ['No mostrar', 'Mostrar'],
|
|
27
|
+
mandatory: false,
|
|
28
|
+
label: 'Mostrar autor en la card',
|
|
29
|
+
help: 'Si está ACTIVADO, se muestra "Por [autor]" debajo de la descripción de cada card. El nombre del autor se incluye SIEMPRE en los datos estructurados (JSON-LD), con independencia de esta opción. Default: desactivado',
|
|
30
|
+
example_value: 'false'
|
|
31
|
+
},
|
|
12
32
|
{
|
|
13
33
|
name: 'items',
|
|
14
34
|
type: 'list',
|
|
@@ -21,10 +41,13 @@ export const metadata: ComponentMetadata = {
|
|
|
21
41
|
{ 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
42
|
{ 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
43
|
{ 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: '
|
|
44
|
+
{ 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
45
|
{ 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
46
|
{ 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]"
|
|
47
|
+
{ name: 'author', type: 'text', help: 'Nombre del autor del contenido. Se incluye SIEMPRE en los datos estructurados (JSON-LD author). Solo se muestra visualmente como "Por [nombre]" si "Mostrar autor en la card" está activado. Si se deja vacío, no se emite autoría', label: 'Nombre del autor', example_value: 'María García López' },
|
|
48
|
+
{ name: 'authorType', type: 'select', options: ['Person', 'Organization'], options_labels: ['Persona', 'Organización'], help: 'Tipo schema.org del autor en el JSON-LD. Usar "Organización" cuando el autor sea la propia entidad (p. ej. "Lefebvre"); en el resto de casos, "Persona". Default: Persona', label: 'Tipo de autor (SEO)', example_value: 'Person' },
|
|
49
|
+
{ 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' },
|
|
50
|
+
{ 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
51
|
]
|
|
29
52
|
}
|
|
30
53
|
}
|
|
@@ -107,6 +107,16 @@ export const metadata: ComponentMetadata = {
|
|
|
107
107
|
mandatory: false,
|
|
108
108
|
example_value: ''
|
|
109
109
|
},
|
|
110
|
+
{
|
|
111
|
+
name: 'authorType',
|
|
112
|
+
type: 'select',
|
|
113
|
+
options: ['Person', 'Organization'],
|
|
114
|
+
options_labels: ['Persona', 'Organización'],
|
|
115
|
+
help: 'Tipo schema.org del autor. Usar "Organización" cuando el autor sea la propia entidad (p. ej. "Lefebvre"); en el resto de casos, "Persona". Aplica al author de Article/BlogPosting/NewsArticle y al mainEntity de ProfilePage. Default: Persona',
|
|
116
|
+
label: 'Tipo de autor',
|
|
117
|
+
mandatory: false,
|
|
118
|
+
example_value: 'Person'
|
|
119
|
+
},
|
|
110
120
|
{
|
|
111
121
|
name: 'publisherName',
|
|
112
122
|
type: 'text',
|
|
@@ -8,14 +8,19 @@ 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
|
+
authorType?: 'Person' | 'Organization'; // tipo schema.org del autor en el JSON-LD
|
|
13
14
|
description?: string;
|
|
15
|
+
datePublished?: string; // ISO 8601, para JSON-LD
|
|
16
|
+
keywords?: string; // keywords reales, para JSON-LD y para etiqueta visual
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
const {
|
|
17
20
|
items = [],
|
|
18
|
-
|
|
21
|
+
etiquetaVisible = "fecha",
|
|
22
|
+
showAutor = false,
|
|
23
|
+
}: { items?: MontevideoItem[]; etiquetaVisible?: "fecha" | "keywords"; showAutor?: boolean } = Astro.props;
|
|
19
24
|
|
|
20
25
|
const escapeJson = (s = "") => String(s).replace(/<[^>]*>/g, '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/[\n\r\t]+/g, ' ');
|
|
21
26
|
|
|
@@ -33,8 +38,9 @@ const structuredData = `<script type="application/ld+json">
|
|
|
33
38
|
"description": "${escapeJson(item.description)}"${item.image ? `,
|
|
34
39
|
"image": "${escapeJson(extractImageUrl(item.image))}"` : ""}${item.link ? `,
|
|
35
40
|
"url": "${escapeJson(item.link)}"` : ""}${item.author ? `,
|
|
36
|
-
"author": { "@type": "Person", "name": "${escapeJson(item.author)}" }` : ""}${item.
|
|
37
|
-
"
|
|
41
|
+
"author": { "@type": "${item.authorType === 'Organization' ? 'Organization' : 'Person'}", "name": "${escapeJson(item.author)}" }` : ""}${item.datePublished ? `,
|
|
42
|
+
"datePublished": "${escapeJson(item.datePublished)}"` : ""}${item.keywords ? `,
|
|
43
|
+
"keywords": "${escapeJson(item.keywords)}"` : ""}
|
|
38
44
|
}
|
|
39
45
|
}`).join(',')}]
|
|
40
46
|
}
|
|
@@ -49,8 +55,8 @@ const structuredData = `<script type="application/ld+json">
|
|
|
49
55
|
image={item.image}
|
|
50
56
|
altImage={item.altImage}
|
|
51
57
|
title={item.title}
|
|
52
|
-
tag={item.
|
|
53
|
-
author={item.author}
|
|
58
|
+
tag={etiquetaVisible === "keywords" ? item.keywords : item.fecha}
|
|
59
|
+
author={showAutor ? item.author : ''}
|
|
54
60
|
description={item.description} />
|
|
55
61
|
|
|
56
62
|
))}
|
|
@@ -28,6 +28,7 @@ interface Props {
|
|
|
28
28
|
authorUrl?: string;
|
|
29
29
|
authorImage?: string;
|
|
30
30
|
authorId?: string;
|
|
31
|
+
authorType?: 'Person' | 'Organization';
|
|
31
32
|
publisherName?: string;
|
|
32
33
|
publisherLogo?: string;
|
|
33
34
|
publisherUrl?: string;
|
|
@@ -54,6 +55,7 @@ const {
|
|
|
54
55
|
authorUrl,
|
|
55
56
|
authorImage,
|
|
56
57
|
authorId,
|
|
58
|
+
authorType = 'Person',
|
|
57
59
|
publisherName = 'Lefebvre',
|
|
58
60
|
publisherLogo = 'https://assets.lefebvre.es/media/logos-2/svg/lefebvre.svg',
|
|
59
61
|
publisherUrl = 'https://lefebvre.es',
|
|
@@ -92,9 +94,9 @@ if (isArticleType) {
|
|
|
92
94
|
if (authorId) {
|
|
93
95
|
schema.author = { '@id': authorId };
|
|
94
96
|
} else if (authorName) {
|
|
95
|
-
const author: Record<string, unknown> = { '@type':
|
|
97
|
+
const author: Record<string, unknown> = { '@type': authorType, name: authorName };
|
|
96
98
|
if (authorUrl) author.url = authorUrl;
|
|
97
|
-
if (authorImage) author.image = authorImage;
|
|
99
|
+
if (authorImage && authorType === 'Person') author.image = authorImage;
|
|
98
100
|
schema.author = author;
|
|
99
101
|
}
|
|
100
102
|
if (publisherId) {
|
|
@@ -123,6 +125,12 @@ if (pageType === 'FAQPage' && faqItems.length) {
|
|
|
123
125
|
if (pageType === 'ProfilePage' && (authorName || authorId)) {
|
|
124
126
|
if (authorId) {
|
|
125
127
|
schema.mainEntity = { '@id': authorId };
|
|
128
|
+
} else if (authorType === 'Organization') {
|
|
129
|
+
const organization: Record<string, unknown> = { '@type': 'Organization', name: authorName };
|
|
130
|
+
if (authorUrl) organization.url = authorUrl;
|
|
131
|
+
if (description) organization.description = description;
|
|
132
|
+
if (sameAs && sameAs.length) organization.sameAs = sameAs;
|
|
133
|
+
schema.mainEntity = organization;
|
|
126
134
|
} else {
|
|
127
135
|
const person: Record<string, unknown> = { '@type': 'Person', name: authorName };
|
|
128
136
|
if (authorUrl) person.url = authorUrl;
|