Noticias - CAE+E
Experiencias de acompañamiento
Se ha producido un error al procesar la plantilla.
The following has evaluated to null or missing:
==> field.elementText("dynamic-content") [in template "20102#20129#19392301" at line 179, column 50]
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign categoria = field.elementText... [in template "20102#20129#19392301" at line 179, column 29]
----
1<#--
2 Plantilla de Publicador de Contenidos para Liferay 7.4
3 Integración: Herencia Total de Estilos Globales (Configurador CSS)
4 Estructura Origen de Datos del Publicador: DC - Noticias
5 Funcionalidad: Parrilla Estática limpia con Container Queries y Botón de Edición Pro
6-->
7
8<#-- =========================================================================
9 1. ESTILOS CSS DE LA PLANTILLA
10 ========================================================================= -->
11<style>
12 /* Contenedor y Grid */
13 .dircom-container-general {
14 width: 100%;
15 display: flex;
16 background-color: #FFFFFF;
17 padding: 0px 30px;
18 }
19
20 .dircom-news-section {
21 width: 100%;
22 max-width: 1200px;
23 margin: 0 auto;
24 padding: 0px;
25 background-color: #FFFFFF;
26 overflow: hidden;
27 container-type: inline-size;
28 }
29
30 /* Rejilla Estática para las tarjetas */
31 .dircom-news-grid {
32 display: grid;
33 grid-template-columns: 1fr; /* 1 columna por defecto en móviles */
34 gap: var(--xl, 30px);
35 padding-bottom: var(--xl, 30px);
36 width: 100%;
37 }
38
39 /* Tarjetas (Cards - Estilo original) */
40 .dircom-clickable-card {
41 text-decoration: none !important;
42 display: block;
43 transition: transform 0.3s ease;
44 position: relative;
45 }
46
47 .dircom-clickable-card:hover {
48 transform: translateY(-5px); /* Efecto sutil de elevación */
49 }
50
51 .dircom-news-card {
52 background-color: transparent;
53 display: flex;
54 flex-direction: column;
55 }
56
57 .dircom-news-img {
58 width: 100%;
59 aspect-ratio: 16 / 9;
60 object-fit: cover;
61 border-radius: var(--radio-m, 8px);
62 box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
63 margin-bottom: var(--l, 20px);
64 }
65
66 .dircom-news-tag {
67 align-self: flex-start;
68 display: inline-block;
69 color: var(--color-ppal, #00539b);
70 border: 1px solid var(--color-ppal, #00539b);
71 font-family: var(--sec-font, sans-serif);
72 font-size: 0.75rem;
73 font-weight: 600;
74 padding: var(--xs, 5px) var(--m, 15px);
75 border-radius: var(--radio-s, 4px);
76 margin-bottom: var(--m, 15px);
77 text-transform: uppercase;
78 letter-spacing: 1px;
79 margin-left: 1px;
80 }
81
82 .dircom-news-excerpt {
83 font-family: var(--sec-font, sans-serif);
84 font-size: var(--p-size, 1rem);
85 color: var(--color-txt, #333333);
86 line-height: 1.5;
87 margin: 0;
88 display: -webkit-box;
89 -webkit-line-clamp: 3;
90 -webkit-box-orient: vertical;
91 overflow: hidden;
92 }
93
94 /* Botón de Edición Pro (Para redactores autorizados) */
95 .dircom-edit-btn {
96 position: absolute;
97 top: 15px;
98 right: 15px;
99 z-index: 20;
100 width: 38px;
101 height: 38px;
102 display: flex;
103 align-items: center;
104 justify-content: center;
105 color: var(--color-ppal, #00539b) !important;
106 text-decoration: none !important;
107 transition: all 0.3s ease;
108 opacity: 0;
109 background: #FFF;
110 border: none;
111 border-radius: 50%;
112 }
113
114 .dircom-clickable-card:hover .dircom-edit-btn {
115 opacity: 1;
116 }
117
118 .dircom-edit-btn:hover {
119 opacity: 1 !important;
120 transform: scale(1.15);
121 }
122
123 .dircom-edit-btn svg {
124 width: 22px;
125 height: 22px;
126 }
127
128 /* Responsivo basado en el tamaño del contenedor */
129 @container (min-width: 500px) {
130 .dircom-news-grid {
131 grid-template-columns: repeat(2, 1fr);
132 }
133 }
134
135 @container (min-width: 800px) {
136 .dircom-news-grid {
137 grid-template-columns: repeat(3, 1fr);
138 }
139 }
140</style>
141
142<#-- =========================================================================
143 2. ESTRUCTURA HTML DEL PUBLICADOR (Mapeo de DC-Noticias a la Rejilla)
144 ========================================================================= -->
145<section class="dircom-container-general">
146 <div class="dircom-news-section">
147 <div class="dircom-news-grid" id="grid-${randomNamespace}">
148
149 <#if entries?has_content>
150 <#list entries as curEntry>
151 <#assign
152 assetRenderer = curEntry.getAssetRenderer()
153 journalArticle = assetRenderer.getArticle()
154 document = saxReaderUtil.read(journalArticle.getContentByLocale(locale))
155 rootElement = document.getRootElement()
156
157 titulo = ""
158 lead = ""
159 imagenUrl = ""
160 categoria = ""
161 linkDestino = ""
162
163 fields = rootElement.elements()
164 />
165
166 <#-- Mapeo de la estructura de noticias original -->
167 <#list fields as field>
168 <#if field.attributeValue("name") == "Text82312881">
169 <#assign titulo = field.elementText("dynamic-content") />
170 <#elseif field.attributeValue("name") == "RichText01877116">
171 <#assign lead = field.elementText("dynamic-content") />
172 <#elseif field.attributeValue("name") == "Image59814167">
173 <#assign imagenJson = field.elementText("dynamic-content") />
174 <#if imagenJson?contains("url")>
175 <#assign json = jsonFactoryUtil.createJSONObject(imagenJson) />
176 <#assign imagenUrl = json.getString("url") />
177 </#if>
178 <#elseif field.attributeValue("name") == "Text36931837">
179 <#assign categoria = field.elementText("dynamic-content") />
180 <#elseif field.attributeValue("name") == "Text72233375">
181 <#assign linkDestino = field.elementText("dynamic-content") />
182 </#if>
183 </#list>
184
185 <#-- Enlace por defecto al detalle si no tiene link personalizado -->
186 <#if !linkDestino?has_content>
187 <#assign linkDestino = assetRenderer.getURLViewInContext(renderRequest, renderResponse, '') />
188 </#if>
189
190 <div class="dircom-clickable-card">
191 <#-- BOTÓN DE EDICIÓN PRO -->
192 <#if themeDisplay.isSignedIn()>
193 <#if assetRenderer.hasEditPermission(themeDisplay.getPermissionChecker())>
194 <#assign editUrl = assetRenderer.getURLEdit(renderRequest, renderResponse)!"" />
195 <#if editUrl?has_content>
196 <a href="${editUrl}" class="dircom-edit-btn" title="Editar contenido" target="_blank">
197 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
198 <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
199 <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
200 </svg>
201 </a>
202 </#if>
203 </#if>
204 </#if>
205
206 <a href="${linkDestino}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;">
207 <article class="dircom-news-card">
208 <#if imagenUrl?has_content>
209 <img src="${imagenUrl}" alt="${titulo}" class="dircom-news-img" loading="lazy">
210 </#if>
211
212 <#if categoria?has_content>
213 <div class="dircom-news-tag">${categoria}</div>
214 </#if>
215
216 <h4>${titulo}</h4>
217
218 <#if lead?has_content>
219 <div class="dircom-news-excerpt">
220 ${lead?replace("<[^>]*>", "", "r")}
221 </div>
222 </#if>
223 </article>
224 </a>
225 </div>
226 </#list>
227 </#if>
228 </div>
229 </div>
230</section>
