Artículos de Carlos Soria

Carlos Soria Porta

Veterinario
Experto en

Veterinario con más de 8 años de experiencia en medicina interna, diagnóstico por imagen y manejo de casos clínicos complejos en perros y gatos. Reconocido por su criterio técnico, precisión diagnóstica y capacidad para interpretar historiales médicos con enfoque experto. Colabora como referente clínico aportando análisis especializado y visión integral del riesgo en el ámbito asegurador.

Más artículos del autor
Se ha producido un error al procesar la plantilla.
Can't convert this string to number: "carlos-soria"
The blamed expression:
==> preferences[0]?number  [in template "20096#20121#45888" at line 16, column 71]

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign categoriaListado = assetCateg...  [in template "20096#20121#45888" at line 16, column 5]
----
1<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") > 
2<#assign assetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")> 
3<#assign assetTagLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetTagLocalService")> 
4<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")> 
5<#assign assetEntryQuery = objectUtil('com.liferay.asset.kernel.service.persistence.AssetEntryQuery')> 
6<#assign void = assetEntryQuery.setOrderByCol1("displayDate")> 
7<#assign layoutName = themeDisplay.getLayout().name> 
8<#if layoutName?contains("Artículos de")> 
9	<#assign preferences = portletPreferences['queryValues0']> 
10  <#assign tagListado = assetTagLocalService.getTag(themeDisplay.getScopeGroupId(), preferences[0])> 
11	<#assign tagValidaQuery = [tagListado.tagId]> 
12	<#assign void = assetEntryQuery.setAnyTagIds(tagValidaQuery)> 
13<#else> 
14	<#if portletPreferences['queryValues0']??> 
15	  <#assign preferences = portletPreferences['queryValues0']> 
16    <#assign categoriaListado = assetCategoryLocalService.getCategory(preferences[0]?number)> 
17	  <#assign categoriaValidaQuery = [categoriaListado.categoryId]> 
18	  <#assign void = assetEntryQuery.setAnyCategoryIds(categoriaValidaQuery)> 
19  <#else> 
20	  <#assign groupIds = [themeDisplay.getScopeGroupId()]> 
21	  <#assign void = assetEntryQuery.setGroupIds(groupIds)> 
22  </#if> 
23</#if> 
24 
25<#assign relatedNews = assetEntryLocalService.getEntries(assetEntryQuery)> 
26<#assign localeCurrent = themeDisplay.getLocale()/> 
27<#assign scriptCode = '{ 
28"@context":"http://schema.org",  
29"@type":"ItemList",  
30"itemListElement":['> 
31<#assign contadorPosition = 1> 
32<#list relatedNews as related> 
33    <#if related.getClassName() == "com.liferay.journal.model.JournalArticle"> 
34        <#assign assetRenderer = related.getAssetRenderer()/> 
35        <#assign journalArticle =  assetRenderer.getAssetObject() /> 
36        <#if journalArticle.DDMTemplateKey?contains("BLOG")> 
37            <#assign document = saxReaderUtil.read(journalArticle.getContent())> 
38            <#assign rootElement = document.getRootElement()> 
39            <#assign defaultLanguageId = parseXml ("@default-locale", rootElement)> 
40            <#assign blogResumen = getField("blogResumen", localeCurrent, defaultLanguageId, rootElement)!> 
41            <#assign scriptCode = scriptCode + ' 
42{ "@type":"SiteNavigationElement", 
43"position":${contadorPosition}, 
44"name": "${journalArticle.getTitle(themeDisplay.getLocale())}",  
45"description": "${blogResumen?replace("<[^>]+>", "", "r")}",  
46"url":"${themeDisplay.getPortalURL()}/${journalArticle.urlTitle}" 
47},'> 
48            <#assign contadorPosition = contadorPosition + 1 > 
49        </#if> 
50    </#if> 
51</#list> 
52<#assign scriptCode = scriptCode + ' 
53
54}'> 
55 
56<#if entries?has_content> 
57    <div class="lda-blog"> 
58        <div class="container container-p64" id="containerBlog"> 
59            <div id="lda-blog-section" class="row lda-blog__section"> 
60 
61                <#list entries as entry> 
62                    <#assign 
63                    assetRenderer = entry.getAssetRenderer() 
64                    journalArticle = assetRenderer.getArticle() 
65                    url = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry ) 
66                    viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, assetRenderer, entry, !stringUtil.equals(assetLinkBehavior, "showFullContent")) 
67                    /> 
68 
69                    <div data-url="${url}" class="col-12 col-sm-6 col-lg-4 lda-blog__item"> 
70                        <!-- PLANTILLA DE LISTADO --> 
71                        ${journalArticleLocalService.getArticleContent( 
72                        themeDisplay.getScopeGroupId(), journalArticle.getArticleId(), "VIEW", "LDA-BLOG-LISTADO", 
73                        locale, objectUtil("com.liferay.portal.kernel.portlet.PortletRequestModel", 
74                        renderRequest, renderResponse), themeDisplay)} 
75                    </div> 
76 
77                </#list> 
78            </div> 
79        </div> 
80    </div> 
81<#else> 
82    <div class="container"> 
83        <p> 
84            <@liferay.language key="no-results-were-found" /> 
85        </p> 
86    </div> 
87</#if> 
88 
89<script> 
90	  if (!isHidden(document.getElementById("containerBlog"))) {	 
91    (function () { 
92        $(document).ready(function () { 
93            let elemSearchResults = document.getElementsByClassName('search-results')[0]; 
94            let elemParentPagination = document.getElementsByClassName('lfr-pagination')[0]; 
95            elemSearchResults.innerText = elemSearchResults.innerText.replace("el intervalo ",""); 
96            elemSearchResults.innerText = elemSearchResults.innerText.replace(" resultados.",""); 
97            $(elemSearchResults).detach().prependTo(elemParentPagination); 
98 
99            let pagButtonFirstPage = document.querySelector('.lfr-pagination-buttons .first'); 
100            let pagButtonLastPage = document.querySelector('.lfr-pagination-buttons .last'); 
101            pagButtonFirstPage.remove(); 
102            pagButtonLastPage.remove(); 
103 
104            let elemNumTotalPags = document.querySelector('.lfr-pagination-config .lfr-pagination-page-selector div a span'); 
105            let numPag = 1; 
106            if (window.location.href.includes("/pag-")) { 
107                numPag = Number(window.location.href.split("/pag-")[1]); 
108
109            let numTotalPags = Number(elemNumTotalPags.innerText.replace("Página " + numPag + " de ", "")); 
110 
111            let elemPadreNumTotalPags = document.getElementsByClassName("lfr-pagination-config")[0]; 
112            elemPadreNumTotalPags.remove(); 
113 
114            const currentPage = numPag; 
115            const totalPages = numTotalPags; 
116 
117            const container = document.getElementsByClassName('lfr-pagination')[0]; 
118            container.classList.add('d-flex'); 
119            container.appendChild(generatePagination(currentPage, totalPages)); 
120            container.appendChild(generateAnchor()); 
121 
122 
123            // Build custom SEO /pag-N URLs for the Previous/Next buttons. 
124            // The href is now always "javascript:void(0);" (set by the custom JSP 
125            // override of deprecated/start.jsp) to prevent Google from crawling 
126            // the raw Liferay portlet URLs. The target page number is read from 
127            // the data-page-num attribute instead. 
128            $('.lfr-pagination-buttons').find('li a').each(function (index) { 
129                var baseUrl = window.location.href.includes("/pag-") 
130                    ? window.location.href.split("/pag-")[0] 
131                    : window.location.href.replace(/\/?$/, ""); 
132 
133                if (index === 0) { 
134                    // "Previous" button (index 0 after First is removed, or index 1 if First still present) 
135                    // We handle both cases via data-page-num 
136                    var pageNum = parseInt($(this).attr('data-page-num'), 10); 
137                    if (!isNaN(pageNum) && pageNum >= 1) { 
138                        var customUrl = (pageNum === 1) ? baseUrl + "/" : baseUrl + "/pag-" + pageNum; 
139                        $(this).attr('href', customUrl); 
140                    } else { 
141                        $(this).addClass('disabled'); 
142
143
144                if (index === 1) { 
145                    var pageNum = parseInt($(this).attr('data-page-num'), 10); 
146                    if (!isNaN(pageNum) && pageNum <= totalPages) { 
147                        var customUrl = baseUrl + "/pag-" + pageNum; 
148                        $(this).attr('href', customUrl); 
149                    } else { 
150                        $(this).addClass('disabled'); 
151
152
153                $(this).addClass('low-3'); 
154            }); 
155 
156 
157            function createPageButton(page, isActive = false) { 
158                const button = document.createElement('a'); 
159                button.textContent = page; 
160                button.className = isActive ? 'lda-btn-pagination active' : 'lda-btn-pagination'; 
161                if (window.location.href.includes("/pag-")) { 
162                    if (page === 1) { 
163                        button.href = window.location.href.split("/pag-")[0] + "/"; 
164                    } else { 
165                        button.href = window.location.href.split("/pag-")[0] + "/pag-" + page; 
166
167 
168                } else if (window.location.href.endsWith("/")) { 
169                    if (page === 1) { 
170                        button.href = window.location.href; 
171                    } else { 
172                        button.href = "pag-" + page; 
173
174 
175                } else { 
176                    if (page === 1) { 
177                        button.href = window.location.href + "/"; 
178                    } else { 
179                        button.href = "/pag-" + page; 
180
181 
182
183                return button; 
184
185 
186            function createEllipsis(startPage, endPage) { 
187                const ellipsis = document.createElement('span'); 
188                ellipsis.textContent = '...'; 
189                ellipsis.className = 'ellipsis'; 
190                return ellipsis; 
191
192 
193            function generatePagination(currentPage, totalPages) { 
194                const paginationContainer = document.createElement('div'); 
195                paginationContainer.className = 'pagination pagination-container'; 
196 
197                if (currentPage <= 3) { 
198                    for (let page = 1; page <= Math.min(4, totalPages); page++) { 
199                        paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
200
201 
202                    if (totalPages > 4) { 
203                        paginationContainer.appendChild(createEllipsis(5, totalPages - 1)); 
204                        paginationContainer.appendChild(createPageButton(totalPages)); 
205
206 
207                    return paginationContainer; 
208
209 
210                if (currentPage >= totalPages - 2) { 
211                    paginationContainer.appendChild(createPageButton(1)); 
212                    paginationContainer.appendChild(createEllipsis(2, totalPages - 4)); 
213                    for (let page = Math.max(totalPages - 3, 1); page <= totalPages; page++) { 
214                        paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
215
216                    return paginationContainer; 
217
218 
219                if (currentPage > 3) { 
220                    paginationContainer.appendChild(createPageButton(1)); 
221
222 
223                if (currentPage > 4) { 
224                    paginationContainer.appendChild(createEllipsis(2, currentPage - 2)); 
225                } else if (currentPage === 4) { 
226                    paginationContainer.appendChild(createEllipsis(2, 2)); 
227
228 
229                const startPage = Math.max(1, currentPage - 1); 
230                const endPage = Math.min(totalPages, currentPage + 1); 
231 
232                for (let page = startPage; page <= endPage; page++) { 
233                    paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
234
235 
236                if (currentPage < totalPages - 3) { 
237                    paginationContainer.appendChild(createEllipsis(currentPage + 2, totalPages - 1)); 
238                } else if (currentPage === totalPages - 3) { 
239                    paginationContainer.appendChild(createEllipsis(totalPages - 1, totalPages - 1)); 
240
241 
242                if (currentPage < totalPages - 2) { 
243                    paginationContainer.appendChild(createPageButton(totalPages)); 
244
245 
246                return paginationContainer; 
247
248 
249            function generateAnchor() { 
250                let anchorLink = document.createElement('a'); 
251                anchorLink.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.6537 5.63931C11.8472 5.45356 12.1528 5.45356 12.3463 5.63931L18.3463 11.3993C18.5455 11.5905 18.5519 11.9071 18.3607 12.1063C18.1695 12.3055 17.8529 12.3119 17.6537 12.1207L12.5 7.17311L12.5 18C12.5 18.2761 12.2761 18.5 12 18.5C11.7239 18.5 11.5 18.2761 11.5 18L11.5 7.17311L6.34627 12.1207C6.14706 12.3119 5.83054 12.3055 5.63931 12.1063C5.44807 11.9071 5.45453 11.5905 5.65373 11.3993L11.6537 5.63931Z" fill="#1A1A1A"/></svg> Subir'; 
252                anchorLink.className = 'd-flex align-items-center lda-link low-3 pr-3'; 
253                anchorLink.onclick = (e) => { 
254                    e.preventDefault(); 
255                    window.scrollTo({ 
256                        top: 0, 
257                        behavior: 'smooth' 
258                    }); 
259                }; 
260                return anchorLink; 
261
262 
263            const isMobile = window.innerWidth < 768; 
264 
265            function adjustPaginationForMobile(currentPage, totalPages) { 
266                const paginationContainer = document.querySelector('.pagination-container'); 
267                paginationContainer.innerHTML = ''; 
268 
269                let paginationButtons = document.querySelector(".lfr-pagination-buttons.pagination"); 
270                let previousLink = paginationButtons.querySelector("li:first-child a"); 
271                let nextLink = paginationButtons.querySelector("li:last-child a"); 
272                let paginationDiv = document.querySelector(".pagination-container"); 
273 
274                if (isMobile) { 
275                    if (currentPage <= 2) { 
276                        for (let page = 1; page <= Math.min(3, totalPages); page++) { 
277                            paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
278
279                        if (totalPages > 3) { 
280                            paginationContainer.appendChild(createEllipsis(4, totalPages - 1)); 
281                            paginationContainer.appendChild(createPageButton(totalPages)); 
282
283                    } else if (currentPage >= totalPages - 1) { 
284                        paginationContainer.appendChild(createPageButton(1)); 
285                        paginationContainer.appendChild(createEllipsis(2, totalPages - 3)); 
286                        for (let page = Math.max(totalPages - 2, 1); page <= totalPages; page++) { 
287                            paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
288
289                    } else { 
290                        paginationContainer.appendChild(createPageButton(1)); 
291                        paginationContainer.appendChild(createEllipsis(2, currentPage - 1)); 
292                        paginationContainer.appendChild(createPageButton(currentPage, true)); 
293                        if (currentPage < totalPages - 1) { 
294                            paginationContainer.appendChild(createEllipsis(currentPage + 1, totalPages - 1)); 
295
296                        paginationContainer.appendChild(createPageButton(totalPages)); 
297
298                    previousLink.innerHTML = '<svg width="24" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M16.8536 20.3536C17.0488 20.1583 17.0488 19.8417 16.8536 19.6464L9.20711 12L16.8536 4.35355C17.0488 4.15829 17.0488 3.84171 16.8536 3.64645C16.6583 3.45118 16.3417 3.45118 16.1464 3.64645L8.14645 11.6464C7.95118 11.8417 7.95118 12.1583 8.14645 12.3536L16.1464 20.3536C16.3417 20.5488 16.6583 20.5488 16.8536 20.3536Z" fill="#1A1A1A"/></svg> '; 
299                    nextLink.innerHTML = ' <svg width="24" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.14645 3.64645C7.95118 3.84171 7.95118 4.15829 8.14645 4.35355L15.7929 12L8.14645 19.6464C7.95118 19.8417 7.95118 20.1583 8.14645 20.3536C8.34171 20.5488 8.65829 20.5488 8.85355 20.3536L16.8536 12.3536C17.0488 12.1583 17.0488 11.8417 16.8536 11.6464L8.85355 3.64645C8.65829 3.45118 8.34171 3.45118 8.14645 3.64645Z" fill="#1A1A1A"/></svg>'; 
300                } else { 
301                    paginationContainer.appendChild(generatePagination(currentPage, totalPages)); 
302                    previousLink.innerHTML = '<svg width="24" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M16.8536 20.3536C17.0488 20.1583 17.0488 19.8417 16.8536 19.6464L9.20711 12L16.8536 4.35355C17.0488 4.15829 17.0488 3.84171 16.8536 3.64645C16.6583 3.45118 16.3417 3.45118 16.1464 3.64645L8.14645 11.6464C7.95118 11.8417 7.95118 12.1583 8.14645 12.3536L16.1464 20.3536C16.3417 20.5488 16.6583 20.5488 16.8536 20.3536Z" fill="#1A1A1A"/></svg> ' + previousLink.innerHTML; 
303                    nextLink.innerHTML = nextLink.innerHTML + ' <svg width="24" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.14645 3.64645C7.95118 3.84171 7.95118 4.15829 8.14645 4.35355L15.7929 12L8.14645 19.6464C7.95118 19.8417 7.95118 20.1583 8.14645 20.3536C8.34171 20.5488 8.65829 20.5488 8.85355 20.3536L16.8536 12.3536C17.0488 12.1583 17.0488 11.8417 16.8536 11.6464L8.85355 3.64645C8.65829 3.45118 8.34171 3.45118 8.14645 3.64645Z" fill="#1A1A1A"/></svg>'; 
304
305 
306                paginationDiv.prepend(previousLink); 
307                paginationDiv.appendChild(nextLink); 
308 
309                paginationButtons.remove(); 
310
311 
312            adjustPaginationForMobile(currentPage, totalPages); 
313 
314            let elemContainerBlog = document.getElementById("containerBlog"); 
315            let elemCompletePagination = document.getElementsByClassName("taglib-page-iterator")[0]; 
316            $(elemCompletePagination).detach().appendTo(elemContainerBlog); 
317 
318 
319            if (isMobile) { 
320                let paginationDiv = document.querySelector(".pagination-container"); 
321                const paginationDivChild = document.createElement('div'); 
322                paginationDivChild.className = 'pagination pagination-container'; 
323                let btnAnterior = paginationDiv.firstElementChild; 
324                paginationDiv.insertBefore(paginationDivChild, btnAnterior.nextSibling); 
325                const elementsToMove = Array.from(paginationDiv.children).slice(2, -1); 
326                elementsToMove.forEach(element => { 
327                    paginationDivChild.appendChild(element); 
328                }); 
329                if (window.location.href.endsWith("/pag-3")) { 
330                    let btnSiguiente = paginationDiv.querySelector('[href="javascript:void(0);"]'); 
331                    if (btnSiguiente) { 
332                        let btnSobrantePag1 = paginationDivChild.children[0]; 
333                        let elipsisSobrante = paginationDivChild.children[1]; 
334                        btnSobrantePag1.remove(); 
335                        elipsisSobrante.remove(); 
336
337
338                let lastPaginationDivChildBtn = paginationDivChild.lastChild; 
339                if (lastPaginationDivChildBtn.href.endsWith("pag-4")) { 
340                    let ellipsisChild = paginationDivChild.querySelector(".ellipsis"); 
341                    ellipsisChild.remove(); 
342
343 
344            } else { 
345                let paginationDivChild = document.querySelector(".pagination-container .pagination-container"); 
346                let currentActiveBtn = paginationDivChild.querySelector(".lda-btn-pagination.active"); 
347                let lastPaginationDivChildBtn = paginationDivChild.lastChild; 
348                if (window.location.href.endsWith("/pag-4") && (lastPaginationDivChildBtn == currentActiveBtn)) { 
349                    let btnSobrantePag1 = paginationDivChild.children[0]; 
350                    let elipsisSobrante = paginationDivChild.children[1]; 
351                    btnSobrantePag1.remove(); 
352                    elipsisSobrante.remove(); 
353
354                if (lastPaginationDivChildBtn.href.endsWith("pag-5")) { 
355                    let ellipsisChild = paginationDivChild.querySelector(".ellipsis"); 
356                    ellipsisChild.remove(); 
357
358
359 
360        }); 
361    })(); 
362
363	 
364	  function isHidden(el) { 
365      return (el.offsetParent === null) 
366
367</script> 
368 
369<script> 
370    AUI().ready(function(){ 
371        var code = JSON.stringify(${scriptCode}); 
372        var script = document.createElement("script"); 
373        script.setAttribute("type", "application/ld+json"); 
374        script.appendChild(document.createTextNode(code)); 
375        document.body.appendChild(script); 
376    }); 
377</script> 
378 
379<#function getField field languageId defaultLanguageId xml> 
380    <#local defaultSelector = "//dynamic-content[@language-id='" + defaultLanguageId + "' and ancestor-or-self::*[@field-reference='" + field + "']]"> 
381    <#local localeSelector = "//dynamic-content[@language-id='" + languageId + "' and parent::*[@field-reference='" + field + "']]"> 
382    <#local selector = saxReaderUtil.createXPath(localeSelector)> 
383    <#local value = selector.selectSingleNode(xml)!> 
384    <#if value?has_content><#return value.getText()></#if> 
385    <#local selector = saxReaderUtil.createXPath(defaultSelector)> 
386    <#local value = selector.selectSingleNode(xml)!> 
387    <#if value?has_content><#return value.getText()></#if> 
388    <#return ""> 
389</#function> 
390 
391<#function parseXml xpath xml> 
392    <#local selector = saxReaderUtil.createXPath(xpath)> 
393    <#local result = selector.selectSingleNode(xml)!> 
394    <#if result?has_content><#return result.getStringValue()></#if> 
395    <#return ""> 
396</#function> 
Se ha producido un error al procesar la plantilla.
Can't convert this string to number: "paloma-pou"
The blamed expression:
==> preferences[0]?number  [in template "20096#20121#3171978" at line 16, column 71]

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign categoriaListado = assetCateg...  [in template "20096#20121#3171978" at line 16, column 5]
----
1<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") > 
2<#assign assetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")> 
3<#assign assetTagLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetTagLocalService")> 
4<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")> 
5<#assign assetEntryQuery = objectUtil('com.liferay.asset.kernel.service.persistence.AssetEntryQuery')> 
6<#assign void = assetEntryQuery.setOrderByCol1("displayDate")> 
7<#assign layoutName = themeDisplay.getLayout().name> 
8<#if layoutName?contains("Artículos de")> 
9	<#assign preferences = portletPreferences['queryValues0']> 
10  <#assign tagListado = assetTagLocalService.getTag(themeDisplay.getScopeGroupId(), preferences[0])> 
11	<#assign tagValidaQuery = [tagListado.tagId]> 
12	<#assign void = assetEntryQuery.setAnyTagIds(tagValidaQuery)> 
13<#else> 
14	<#if portletPreferences['queryValues0']??> 
15	  <#assign preferences = portletPreferences['queryValues0']> 
16    <#assign categoriaListado = assetCategoryLocalService.getCategory(preferences[0]?number)> 
17	  <#assign categoriaValidaQuery = [categoriaListado.categoryId]> 
18	  <#assign void = assetEntryQuery.setAnyCategoryIds(categoriaValidaQuery)> 
19  <#else> 
20	  <#assign groupIds = [themeDisplay.getScopeGroupId()]> 
21	  <#assign void = assetEntryQuery.setGroupIds(groupIds)> 
22  </#if> 
23</#if> 
24<#assign relatedNews = assetEntryLocalService.getEntries(assetEntryQuery)> 
25<#assign localeCurrent = themeDisplay.getLocale()/> 
26 
27<#if entries?has_content> 
28    <div class="lda-blog" id="ldaBlogMini"> 
29        <div class="container container-p64" id="containerBlogMini"> 
30            <div id="lda-blog-section" class="row lda-blog__section"> 
31 
32                <#list entries as entry> 
33                    <#assign 
34                    assetRenderer = entry.getAssetRenderer() 
35                    journalArticle = assetRenderer.getArticle() 
36                    url = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry ) 
37                    viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, assetRenderer, entry, !stringUtil.equals(assetLinkBehavior, "showFullContent")) 
38                    /> 
39 
40                    <div data-url="${url}" class="col-12"> 
41                        <!-- PLANTILLA DE LISTADO --> 
42                        ${journalArticleLocalService.getArticleContent( 
43                        themeDisplay.getScopeGroupId(), journalArticle.getArticleId(), "VIEW", "LDA-BLOG-LISTADO-MINI-S", 
44                        locale, objectUtil("com.liferay.portal.kernel.portlet.PortletRequestModel", 
45                        renderRequest, renderResponse), themeDisplay)} 
46                    </div> 
47 
48                </#list> 
49            </div> 
50        </div> 
51    </div> 
52<#else> 
53    <div class="container"> 
54        <p> 
55            <@liferay.language key="no-results-were-found" /> 
56        </p> 
57    </div> 
58</#if> 
59 
60<script> 
61	  if (!isHiddenMini(document.getElementById("containerBlogMini"))) {	 
62    (function () { 
63        $(document).ready(function () { 
64					  let blogMiniParent = document.getElementById("ldaBlogMini").parentElement; 
65					 
66            let elemSearchResults = blogMiniParent.getElementsByClassName('search-results')[0]; 
67            let elemParentPagination = blogMiniParent.getElementsByClassName('lfr-pagination')[0]; 
68            elemSearchResults.innerText = elemSearchResults.innerText.replace("el intervalo ",""); 
69            elemSearchResults.innerText = elemSearchResults.innerText.replace(" resultados.",""); 
70            $(elemSearchResults).detach().prependTo(elemParentPagination); 
71 
72            let pagButtonFirstPage = blogMiniParent.querySelector('.lfr-pagination-buttons .first'); 
73            let pagButtonLastPage = blogMiniParent.querySelector('.lfr-pagination-buttons .last'); 
74            pagButtonFirstPage.remove(); 
75            pagButtonLastPage.remove(); 
76 
77            let elemNumTotalPags = blogMiniParent.querySelector('.lfr-pagination-config .lfr-pagination-page-selector div a span'); 
78            let numPag = 1; 
79            if (window.location.href.includes("/pag-")) { 
80                numPag = Number(window.location.href.split("/pag-")[1]); 
81
82            let numTotalPags = Number(elemNumTotalPags.innerText.replace("Página " + numPag + " de ", "")); 
83 
84            let elemPadreNumTotalPags = blogMiniParent.getElementsByClassName("lfr-pagination-config")[0]; 
85            elemPadreNumTotalPags.remove(); 
86 
87            const currentPage = numPag; 
88            const totalPages = numTotalPags; 
89 
90            const container = blogMiniParent.getElementsByClassName('lfr-pagination')[0]; 
91            container.classList.add('d-flex'); 
92            container.appendChild(generatePagination(currentPage, totalPages)); 
93            container.appendChild(generateAnchor()); 
94 
95 
96            // Build custom SEO /pag-N URLs for the Previous/Next buttons. 
97            // The href is now always "javascript:void(0);" (set by the custom JSP 
98            // override of deprecated/start.jsp) to prevent Google from crawling 
99            // the raw Liferay portlet URLs. The target page number is read from 
100            // the data-page-num attribute instead. 
101            $('#ldaBlogMini').parent().find('.lfr-pagination-buttons li a').each(function (index) { 
102                var baseUrl = window.location.href.includes("/pag-") 
103                    ? window.location.href.split("/pag-")[0] 
104                    : window.location.href.replace(/\/?$/, ""); 
105 
106                if (index === 0) { 
107                    // "Previous" button (index 0 after First is removed, or index 1 if First still present) 
108                    // We handle both cases via data-page-num 
109                    var pageNum = parseInt($(this).attr('data-page-num'), 10); 
110                    if (!isNaN(pageNum) && pageNum >= 1) { 
111                        var customUrl = (pageNum === 1) ? baseUrl + "/" : baseUrl + "/pag-" + pageNum; 
112                        $(this).attr('href', customUrl); 
113                    } else { 
114                        $(this).addClass('disabled'); 
115
116
117                if (index === 1) { 
118                    var pageNum = parseInt($(this).attr('data-page-num'), 10); 
119                    if (!isNaN(pageNum) && pageNum <= totalPages) { 
120                        var customUrl = baseUrl + "/pag-" + pageNum; 
121                        $(this).attr('href', customUrl); 
122                    } else { 
123                        $(this).addClass('disabled'); 
124
125
126                $(this).addClass('low-3'); 
127            }); 
128 
129 
130            function createPageButton(page, isActive = false) { 
131                const button = document.createElement('a'); 
132                button.textContent = page; 
133                button.className = isActive ? 'lda-btn-pagination active' : 'lda-btn-pagination'; 
134                if (window.location.href.includes("/pag-")) { 
135                    if (page === 1) { 
136                        button.href = window.location.href.split("/pag-")[0] + "/"; 
137                    } else { 
138                        button.href = window.location.href.split("/pag-")[0] + "/pag-" + page; 
139
140 
141                } else if (window.location.href.endsWith("/")) { 
142                    if (page === 1) { 
143                        button.href = window.location.href; 
144                    } else { 
145                        button.href = "pag-" + page; 
146
147 
148                } else { 
149                    if (page === 1) { 
150                        button.href = window.location.href + "/"; 
151                    } else { 
152                        button.href = "/pag-" + page; 
153
154 
155
156                return button; 
157
158 
159            function createEllipsis(startPage, endPage) { 
160                const ellipsis = document.createElement('span'); 
161                ellipsis.textContent = '...'; 
162                ellipsis.className = 'ellipsis'; 
163                return ellipsis; 
164
165 
166            function generatePagination(currentPage, totalPages) { 
167                const paginationContainer = document.createElement('div'); 
168                paginationContainer.className = 'pagination pagination-container'; 
169 
170                if (currentPage <= 3) { 
171                    for (let page = 1; page <= Math.min(4, totalPages); page++) { 
172                        paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
173
174 
175                    if (totalPages > 4) { 
176                        paginationContainer.appendChild(createEllipsis(5, totalPages - 1)); 
177                        paginationContainer.appendChild(createPageButton(totalPages)); 
178
179 
180                    return paginationContainer; 
181
182 
183                if (currentPage >= totalPages - 2) { 
184                    paginationContainer.appendChild(createPageButton(1)); 
185                    paginationContainer.appendChild(createEllipsis(2, totalPages - 4)); 
186                    for (let page = Math.max(totalPages - 3, 1); page <= totalPages; page++) { 
187                        paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
188
189                    return paginationContainer; 
190
191 
192                if (currentPage > 3) { 
193                    paginationContainer.appendChild(createPageButton(1)); 
194
195 
196                if (currentPage > 4) { 
197                    paginationContainer.appendChild(createEllipsis(2, currentPage - 2)); 
198                } else if (currentPage === 4) { 
199                    paginationContainer.appendChild(createEllipsis(2, 2)); 
200
201 
202                const startPage = Math.max(1, currentPage - 1); 
203                const endPage = Math.min(totalPages, currentPage + 1); 
204 
205                for (let page = startPage; page <= endPage; page++) { 
206                    paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
207
208 
209                if (currentPage < totalPages - 3) { 
210                    paginationContainer.appendChild(createEllipsis(currentPage + 2, totalPages - 1)); 
211                } else if (currentPage === totalPages - 3) { 
212                    paginationContainer.appendChild(createEllipsis(totalPages - 1, totalPages - 1)); 
213
214 
215                if (currentPage < totalPages - 2) { 
216                    paginationContainer.appendChild(createPageButton(totalPages)); 
217
218 
219                return paginationContainer; 
220
221 
222            function generateAnchor() { 
223                let anchorLink = document.createElement('a'); 
224                anchorLink.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.6537 5.63931C11.8472 5.45356 12.1528 5.45356 12.3463 5.63931L18.3463 11.3993C18.5455 11.5905 18.5519 11.9071 18.3607 12.1063C18.1695 12.3055 17.8529 12.3119 17.6537 12.1207L12.5 7.17311L12.5 18C12.5 18.2761 12.2761 18.5 12 18.5C11.7239 18.5 11.5 18.2761 11.5 18L11.5 7.17311L6.34627 12.1207C6.14706 12.3119 5.83054 12.3055 5.63931 12.1063C5.44807 11.9071 5.45453 11.5905 5.65373 11.3993L11.6537 5.63931Z" fill="#1A1A1A"/></svg> Subir'; 
225                anchorLink.className = 'd-flex align-items-center lda-link low-3 pr-3'; 
226                anchorLink.onclick = (e) => { 
227                    e.preventDefault(); 
228                    window.scrollTo({ 
229                        top: 0, 
230                        behavior: 'smooth' 
231                    }); 
232                }; 
233                return anchorLink; 
234
235 
236            const isMobile = window.innerWidth < 768; 
237 
238            function adjustPaginationForMobile(currentPage, totalPages) { 
239                const paginationContainer = blogMiniParent.querySelector('.pagination-container'); 
240                paginationContainer.innerHTML = ''; 
241 
242                let paginationButtons = blogMiniParent.querySelector(".lfr-pagination-buttons.pagination"); 
243                let previousLink = paginationButtons.querySelector("li:first-child a"); 
244                let nextLink = paginationButtons.querySelector("li:last-child a"); 
245                let paginationDiv = blogMiniParent.querySelector(".pagination-container"); 
246 
247                if (isMobile) { 
248                    if (currentPage <= 2) { 
249                        for (let page = 1; page <= Math.min(3, totalPages); page++) { 
250                            paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
251
252                        if (totalPages > 3) { 
253                            paginationContainer.appendChild(createEllipsis(4, totalPages - 1)); 
254                            paginationContainer.appendChild(createPageButton(totalPages)); 
255
256                    } else if (currentPage >= totalPages - 1) { 
257                        paginationContainer.appendChild(createPageButton(1)); 
258                        paginationContainer.appendChild(createEllipsis(2, totalPages - 3)); 
259                        for (let page = Math.max(totalPages - 2, 1); page <= totalPages; page++) { 
260                            paginationContainer.appendChild(createPageButton(page, page === currentPage)); 
261
262                    } else { 
263                        paginationContainer.appendChild(createPageButton(1)); 
264                        paginationContainer.appendChild(createEllipsis(2, currentPage - 1)); 
265                        paginationContainer.appendChild(createPageButton(currentPage, true)); 
266                        if (currentPage < totalPages - 1) { 
267                            paginationContainer.appendChild(createEllipsis(currentPage + 1, totalPages - 1)); 
268
269                        paginationContainer.appendChild(createPageButton(totalPages)); 
270
271                    previousLink.innerHTML = '<svg width="24" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M16.8536 20.3536C17.0488 20.1583 17.0488 19.8417 16.8536 19.6464L9.20711 12L16.8536 4.35355C17.0488 4.15829 17.0488 3.84171 16.8536 3.64645C16.6583 3.45118 16.3417 3.45118 16.1464 3.64645L8.14645 11.6464C7.95118 11.8417 7.95118 12.1583 8.14645 12.3536L16.1464 20.3536C16.3417 20.5488 16.6583 20.5488 16.8536 20.3536Z" fill="#1A1A1A"/></svg> '; 
272                    nextLink.innerHTML = ' <svg width="24" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.14645 3.64645C7.95118 3.84171 7.95118 4.15829 8.14645 4.35355L15.7929 12L8.14645 19.6464C7.95118 19.8417 7.95118 20.1583 8.14645 20.3536C8.34171 20.5488 8.65829 20.5488 8.85355 20.3536L16.8536 12.3536C17.0488 12.1583 17.0488 11.8417 16.8536 11.6464L8.85355 3.64645C8.65829 3.45118 8.34171 3.45118 8.14645 3.64645Z" fill="#1A1A1A"/></svg>'; 
273                } else { 
274                    paginationContainer.appendChild(generatePagination(currentPage, totalPages)); 
275                    previousLink.innerHTML = '<svg width="24" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M16.8536 20.3536C17.0488 20.1583 17.0488 19.8417 16.8536 19.6464L9.20711 12L16.8536 4.35355C17.0488 4.15829 17.0488 3.84171 16.8536 3.64645C16.6583 3.45118 16.3417 3.45118 16.1464 3.64645L8.14645 11.6464C7.95118 11.8417 7.95118 12.1583 8.14645 12.3536L16.1464 20.3536C16.3417 20.5488 16.6583 20.5488 16.8536 20.3536Z" fill="#1A1A1A"/></svg> ' + previousLink.innerHTML; 
276                    nextLink.innerHTML = nextLink.innerHTML + ' <svg width="24" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.14645 3.64645C7.95118 3.84171 7.95118 4.15829 8.14645 4.35355L15.7929 12L8.14645 19.6464C7.95118 19.8417 7.95118 20.1583 8.14645 20.3536C8.34171 20.5488 8.65829 20.5488 8.85355 20.3536L16.8536 12.3536C17.0488 12.1583 17.0488 11.8417 16.8536 11.6464L8.85355 3.64645C8.65829 3.45118 8.34171 3.45118 8.14645 3.64645Z" fill="#1A1A1A"/></svg>'; 
277
278 
279                paginationDiv.prepend(previousLink); 
280                paginationDiv.appendChild(nextLink); 
281 
282                paginationButtons.remove(); 
283
284 
285            adjustPaginationForMobile(currentPage, totalPages); 
286 
287            let elemContainerBlog = document.getElementById("containerBlogMini"); 
288            let elemCompletePagination = blogMiniParent.getElementsByClassName("taglib-page-iterator")[0]; 
289            $(elemCompletePagination).detach().appendTo(elemContainerBlog); 
290 
291 
292            if (isMobile) { 
293                let paginationDiv = blogMiniParent.querySelector(".pagination-container"); 
294                const paginationDivChild = document.createElement('div'); 
295                paginationDivChild.className = 'pagination pagination-container'; 
296                let btnAnterior = paginationDiv.firstElementChild; 
297                paginationDiv.insertBefore(paginationDivChild, btnAnterior.nextSibling); 
298                const elementsToMove = Array.from(paginationDiv.children).slice(2, -1); 
299                elementsToMove.forEach(element => { 
300                    paginationDivChild.appendChild(element); 
301                }); 
302                if (window.location.href.endsWith("/pag-3")) { 
303                    let btnSiguiente = paginationDiv.querySelector('[href="javascript:void(0);"]'); 
304                    if (btnSiguiente) { 
305                        let btnSobrantePag1 = paginationDivChild.children[0]; 
306                        let elipsisSobrante = paginationDivChild.children[1]; 
307                        btnSobrantePag1.remove(); 
308                        elipsisSobrante.remove(); 
309
310
311                let lastPaginationDivChildBtn = paginationDivChild.lastChild; 
312                if (lastPaginationDivChildBtn.href.endsWith("pag-4")) { 
313                    let ellipsisChild = paginationDivChild.querySelector(".ellipsis"); 
314                    ellipsisChild.remove(); 
315
316 
317            } else { 
318                let paginationDivChild = blogMiniParent.querySelector(".pagination-container .pagination-container"); 
319                let currentActiveBtn = paginationDivChild.querySelector(".lda-btn-pagination.active"); 
320                let lastPaginationDivChildBtn = paginationDivChild.lastChild; 
321                if (window.location.href.endsWith("/pag-4") && (lastPaginationDivChildBtn == currentActiveBtn)) { 
322                    let btnSobrantePag1 = paginationDivChild.children[0]; 
323                    let elipsisSobrante = paginationDivChild.children[1]; 
324                    btnSobrantePag1.remove(); 
325                    elipsisSobrante.remove(); 
326
327                if (lastPaginationDivChildBtn.href.endsWith("pag-5")) { 
328                    let ellipsisChild = paginationDivChild.querySelector(".ellipsis"); 
329                    ellipsisChild.remove(); 
330
331
332 
333        }); 
334    })(); 
335
336	 
337	  function isHiddenMini(el) { 
338      return (el.offsetParent === null) 
339
340</script> 
341 
342<#function getField field languageId defaultLanguageId xml> 
343    <#local defaultSelector = "//dynamic-content[@language-id='" + defaultLanguageId + "' and ancestor-or-self::*[@field-reference='" + field + "']]"> 
344    <#local localeSelector = "//dynamic-content[@language-id='" + languageId + "' and parent::*[@field-reference='" + field + "']]"> 
345    <#local selector = saxReaderUtil.createXPath(localeSelector)> 
346    <#local value = selector.selectSingleNode(xml)!> 
347    <#if value?has_content><#return value.getText()></#if> 
348    <#local selector = saxReaderUtil.createXPath(defaultSelector)> 
349    <#local value = selector.selectSingleNode(xml)!> 
350    <#if value?has_content><#return value.getText()></#if> 
351    <#return ""> 
352</#function> 
353 
354<#function parseXml xpath xml> 
355    <#local selector = saxReaderUtil.createXPath(xpath)> 
356    <#local result = selector.selectSingleNode(xml)!> 
357    <#if result?has_content><#return result.getStringValue()></#if> 
358    <#return ""> 
359</#function>