1<#assign
2assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")
3layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService")
4assetVocabularyLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService")
5/>
6<#assign httpUtil = staticUtil["com.liferay.portal.kernel.util.HttpUtil"] >
7
8<#assign siteGroupId = themeDisplay.getSiteGroupId()/>
9<#assign homeURL = portalUtil.getLayoutFriendlyURL(layoutLocalService.getLayoutByFriendlyURL(siteGroupId, false, "/home"), themeDisplay, locale) />
10<#assign currentURL = portalUtil.getCurrentURL(request)/>
11
12<!-- Se recupera el identificador del portlet y el id del asset entry -->
13<#if request.getParameter("p_p_id")?? && request.getParameter("p_p_id") != "">
14 <#assign
15 ppid = request.getParameter("p_p_id")
16 entryIdParam = "_" + ppid + "_assetEntryId"
17 />
18</#if>
19
20<!-- Se recupera el asset entry de la noticia para obtener el título -->
21<#if request.getParameter(entryIdParam)?? && request.getParameter(entryIdParam) != "">
22 <#assign assetId = request.getParameter(entryIdParam)/>
23</#if>
24
25<#if assetId?? && assetId != "">
26 <#assign assetEntry = assetEntryLocalService.fetchEntry(assetId?number) />
27
28 <#if assetEntry?? && assetEntry != "">
29 <#assign
30 assetRenderer = assetEntry.getAssetRenderer()
31 article = assetRenderer.getArticle()
32 categories = assetEntry.getCategories()
33 document = saxReaderUtil.read(article.getContent())
34 rootElement = document.getRootElement()
35 defaultLanguageId = parseXml ("@default-locale", rootElement)
36 vocabulary = assetVocabularyLocalService.getGroupVocabulary(siteGroupId, "secciones")
37 vocabularyId = vocabulary.getVocabularyId()
38 />
39
40 <#assign title = getField("title", locale, defaultLanguageId, rootElement)!>
41 <!-- Se recuperan las categorías del asset entry y se añade la primera categoría encontrada -->
42 <#if categories?has_content>
43 <#assign isFirst = true>
44 <#list categories as category>
45 <#if isFirst && category.getVocabularyId() == vocabularyId?number>
46 <#assign isFirst = false>
47 <#assign layoutName = category.getTitle(locale) />
48 <#assign noAccents = removeAccents(layoutName?lower_case) />
49 <#assign urlToSearch = "/" + noAccents />
50
51 <#if layoutLocalService.fetchLayoutByFriendlyURL(siteGroupId, false, urlToSearch)??>
52 <#assign layout = layoutLocalService.getLayoutByFriendlyURL(siteGroupId, false, urlToSearch) />
53
54 <#if layout.hasChildren()>
55 <#assign layoutURL = getChildURL(layout) />
56 <#else>
57 <#assign layoutURL = portalUtil.getLayoutFriendlyURL(layout, themeDisplay, locale) />
58 </#if>
59
60 <#assign parentId = layout.getParentLayoutId() />
61
62 <#if (parentId?number > 0) >
63 <#assign parentLayout = layoutLocalService.getLayout(siteGroupId, false, parentId?number)/>
64 <#assign parentName = parentLayout.getName(locale) />
65 </#if>
66 </#if>
67 </#if>
68 </#list>
69 </#if>
70 </#if>
71</#if>
72
73<div class="container ss-breadcrumbs">
74 <ul class="d-flex">
75 <li class="mr-2 d-flex align-items-center justify-content-center">
76 <a class="ss-text-link ss-text-link--black" href="${homeURL}"><@liferay.language key="home" /></a>
77 <i class="ss-icon ss-icon-chevron-right ss-icon--8 ml-2"></i>
78 </li>
79
80 <#if layoutName?? && layoutName != "" >
81 <#if parentName?? && parentName != "">
82 <li class="mr-2 d-flex align-items-center justify-content-center">
83 ${parentName}
84 <i class="ss-icon ss-icon-chevron-right ss-icon--8 ml-2">
85 </i>
86 </#if>
87
88 <li class="mr-2 d-flex align-items-center justify-content-center">
89 <#if layoutURL?? && layoutURL != "">
90 <a class="ss-text-link ss-text-link--black" href="${layoutURL}">
91 </#if>
92 ${layoutName}
93 <#if layoutURL?? && layoutURL != "">
94 </a>
95 </#if>
96 <i class="ss-icon ss-icon-chevron-right ss-icon--8 ml-2"></i>
97 </li>
98 <#else>
99 <#if entries?has_content>
100 <#list entries as entry>
101 <#assign url = getterUtil.getString(entry.getURL()) />
102 <#if validator.isNotNull(url) >
103 <#assign friendlyURL = url?keep_after_last("/") />
104 <#assign friendlyURL = "/" + friendlyURL />
105
106 <#if layoutLocalService.fetchLayoutByFriendlyURL(siteGroupId, false, friendlyURL)??>
107 <#assign entryLayout = layoutLocalService.fetchLayoutByFriendlyURL(siteGroupId, false, friendlyURL) />
108 <#assign parentId = entryLayout.getParentLayoutId() />
109
110 <#if (parentId?number > 0) >
111 <#assign parentLayout = layoutLocalService.fetchLayout(siteGroupId, false, parentId?number)/>
112 <#assign isHidden = parentLayout.isHidden() />
113 <#assign parentName = parentLayout.getName(locale) />
114 </#if>
115 </#if>
116 </#if>
117
118 <#if parentName?? && parentName != "" && isHidden?? && !isHidden >
119 <li class="entry d-flex" >
120 ${htmlUtil.escape(parentName)}
121 <i class="ss-icon ss-icon-chevron-right ss-icon--8 ml-2 mt-2 mr-2"></i>
122 </li>
123 </#if>
124
125 <#if entry?is_last>
126 <#assign cssClass = "active" />
127 </#if>
128
129 <li <#if entry?is_last>aria-current="page"</#if>>
130 <#if entry?has_next>
131 <a
132 <#if entry.isBrowsable()>
133 href="${entry.getURL()!""}"
134 </#if>
135 >
136 </#if>
137
138 <#if (!url?contains("/-/") && !url?contains(homeURL) && entryLayout?? && !entryLayout.isHidden()) || (url?contains("search"))>
139 <div class="entry d-flex text--color">
140 <strong>${htmlUtil.escape(entry.getTitle())}</strong>
141
142 <#if entry?has_next>
143 <i class="ss-icon ss-icon-chevron-right ss-icon--8 ml-2"></i>
144 </#if>
145 </div>
146 </#if>
147 <#if entry?has_next>
148 </a>
149 </#if>
150 </li>
151
152 </#list>
153 </#if>
154 </#if>
155
156 <#if title?? && title != "">
157 <li class="d-flex align-items-center justify-content-center text--color"><strong>${title}</strong></li>
158 </#if>
159 </ul>
160</div>
161
162<!-- FUNCTIONS -->
163
164<#function getField field languageId defaultLanguageId xml>
165 <#local defaultSelector = "//dynamic-content[@language-id='" + defaultLanguageId + "' and ancestor-or-self::*[@name='" + field + "']]">
166 <#local localeSelector = "//dynamic-content[@language-id='" + languageId + "' and parent::*[@name='" + field + "']]">
167
168 <#local selector = saxReaderUtil.createXPath(localeSelector)>
169 <#local value = selector.selectSingleNode(xml)!>
170
171 <#if value?has_content>
172 <#return value.getText()>
173 </#if>
174
175 <#local selector = saxReaderUtil.createXPath(defaultSelector)>
176 <#local value = selector.selectSingleNode(xml)!>
177
178 <#if value?has_content>
179 <#return value.getText()>
180 </#if>
181
182 <#return "">
183</#function>
184
185<#function parseXml xpath xml>
186 <#local selector = saxReaderUtil.createXPath(xpath)>
187 <#local result = selector.selectSingleNode(xml)!>
188
189 <#if result?has_content>
190 <#return result.getStringValue()>
191 </#if>
192
193 <#return "">
194</#function>
195
196<#function getChildURL layout>
197 <#assign layoutURL = "" />
198 <#list layout.getChildren() as child>
199 <#if !child.hidden>
200 <#assign layoutURL = portalUtil.getLayoutFriendlyURL(child, themeDisplay, locale) />
201 <#return layoutURL>
202 </#if>
203 </#list>
204 <#assign layoutURL = portalUtil.getLayoutFriendlyURL(layout, themeDisplay, locale) />
205 <#return layoutURL>
206</#function>
207
208<#function removeAccents name>
209 <#assign plainName = name />
210
211 <#if name?contains('á')>
212 <#assign plainName = name?replace('á', 'a') />
213 </#if>
214 <#if name?contains('é')>
215 <#assign plainName = name?replace('é', 'e') />
216 </#if>
217 <#if name?contains('í')>
218 <#assign plainName = name?replace('í', 'i') />
219 </#if>
220 <#if name?contains('ó')>
221 <#assign plainName = name?replace('ó', 'o') />
222 </#if>
223 <#if name?contains('ú')>
224 <#assign plainName = name?replace('ú', 'u') />
225 </#if>
226 <#if name?contains('ü')>
227 <#assign plainName = name?replace('ü', 'u') />
228 </#if>
229 <#if name?contains(' ')>
230 <#assign plainName = name?replace(' ', '-') />
231 </#if>
232
233 <#return plainName />
234</#function>