libreria-astro-lefebvre 0.1.32 → 0.1.35

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libreria-astro-lefebvre",
3
- "version": "0.1.32",
3
+ "version": "0.1.35",
4
4
  "description": "Librería de componentes Astro, React y Vue para Lefebvre",
5
5
  "author": "Equipo web desarrollo Lefebvre",
6
6
  "type": "module",
@@ -19,6 +19,16 @@ export const metadata: ComponentMetadata = {
19
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
20
  example_value: 'fecha'
21
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
+ },
22
32
  {
23
33
  name: 'items',
24
34
  type: 'list',
@@ -34,7 +44,8 @@ export const metadata: ComponentMetadata = {
34
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' },
35
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' },
36
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' },
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' },
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' },
38
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' },
39
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' }
40
51
  ]
@@ -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',
@@ -10,6 +10,7 @@ interface MontevideoItem {
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;
14
15
  datePublished?: string; // ISO 8601, para JSON-LD
15
16
  keywords?: string; // keywords reales, para JSON-LD y para etiqueta visual
@@ -18,7 +19,8 @@ interface MontevideoItem {
18
19
  const {
19
20
  items = [],
20
21
  etiquetaVisible = "fecha",
21
- }: { items?: MontevideoItem[]; etiquetaVisible?: "fecha" | "keywords" } = Astro.props;
22
+ showAutor = false,
23
+ }: { items?: MontevideoItem[]; etiquetaVisible?: "fecha" | "keywords"; showAutor?: boolean } = Astro.props;
22
24
 
23
25
  const escapeJson = (s = "") => String(s).replace(/<[^>]*>/g, '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/[\n\r\t]+/g, ' ');
24
26
 
@@ -36,7 +38,7 @@ const structuredData = `<script type="application/ld+json">
36
38
  "description": "${escapeJson(item.description)}"${item.image ? `,
37
39
  "image": "${escapeJson(extractImageUrl(item.image))}"` : ""}${item.link ? `,
38
40
  "url": "${escapeJson(item.link)}"` : ""}${item.author ? `,
39
- "author": { "@type": "Person", "name": "${escapeJson(item.author)}" }` : ""}${item.datePublished ? `,
41
+ "author": { "@type": "${item.authorType === 'Organization' ? 'Organization' : 'Person'}", "name": "${escapeJson(item.author)}" }` : ""}${item.datePublished ? `,
40
42
  "datePublished": "${escapeJson(item.datePublished)}"` : ""}${item.keywords ? `,
41
43
  "keywords": "${escapeJson(item.keywords)}"` : ""}
42
44
  }
@@ -54,7 +56,7 @@ const structuredData = `<script type="application/ld+json">
54
56
  altImage={item.altImage}
55
57
  title={item.title}
56
58
  tag={etiquetaVisible === "keywords" ? item.keywords : item.fecha}
57
- author={item.author}
59
+ author={showAutor ? item.author : ''}
58
60
  description={item.description} />
59
61
 
60
62
  ))}
@@ -49,7 +49,7 @@ const structuredData = address ? `<script type="application/ld+json">
49
49
  </script>` : '';
50
50
  ---
51
51
 
52
- <section class={`w-full max-w-[1200px] mx-auto py-10 ${hasBackground ? 'px-6 md:px-8 rounded-2xl' : 'px-6 md:px-0'}`} style={`color:${textColor}${hasBackground ? `;background-color:${backgroundColor}` : ''}`}>
52
+ <section id="contactMap" class={`w-full max-w-[1200px] mx-auto py-10 ${hasBackground ? 'px-6 md:px-8 rounded-2xl' : 'px-6 md:px-0'}`} style={`color:${textColor}${hasBackground ? `;background-color:${backgroundColor}` : ''}`}>
53
53
  {(title || description) && (
54
54
  <div class="mb-8 text-center">
55
55
  {title && (
@@ -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': 'Person', name: authorName };
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;