1<#assign assetCategoryService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")
2 assetCategoryPropertyService = serviceLocator.findService("com.liferay.asset.category.property.service.AssetCategoryPropertyLocalService")
3 SAXReaderUtil = staticUtil["com.liferay.portal.kernel.xml.SAXReaderUtil"]
4 HtmlUtil = staticUtil["com.liferay.portal.kernel.util.HtmlUtil"]
5 layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService")
6 PortletURLFactoryUtil = staticUtil["com.liferay.portal.kernel.portlet.PortletURLFactoryUtil"]
7 PortletRequest = staticUtil["javax.portlet.PortletRequest"]
8 journalArticleService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")
9 ParamUtil = staticUtil["com.liferay.portal.kernel.util.ParamUtil"]
10 categoryId =ParamUtil.getLong(renderRequest,"categoryId", 0)
11 maxLoop = 100
12/>
13
14<#if (categoryId <= 0) >
15
16 <#if entries?has_content>
17 <#foreach aCategory in entries?first.getCategories()>
18 <#assign aCategory = aCategory/>
19 <#break>
20 </#foreach>
21 <#list 1..maxLoop as i>
22 <#list 1..maxLoop as j>
23 <#if aCategory.getParentCategory()?has_content>
24 <#assign aCategory = aCategory.getParentCategory()/>
25 <#else>
26 <#assign categoryId = aCategory.getCategoryId()/>
27 </#if>
28 <#break>
29 </#list>
30 <#if (categoryId > 0) >
31 <#break>
32 </#if>
33 </#list>
34 </#if>
35
36</#if>
37
38<nav aria-label="breadcrumb">
39 <ol class="breadcrumb">
40 <li class="breadcrumb-title"><span>${languageUtil.get(locale,"webasturias.breadcrumb-title")}</span></li>
41 <#--<li class="breadcrumb-item"><a href="/">${languageUtil.get(locale,"webasturias.breadcrumb-asturias")}</a></li>-->
42
43 <#if (categoryId > 0) >
44
45 <#assign category = assetCategoryService.getAssetCategory(categoryId)
46 breadCrumbContent = ""
47 categoryAncestors = category.getAncestors()/>
48
49 <#if categoryAncestors?has_content>
50 <#foreach categoryAncestor in categoryAncestors>
51
52 <#assign detailPage = "general"
53 layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) />
54
55 <#-- obtener el contenido de la categoría hija -->
56 <#assign contentId = (assetCategoryPropertyService.fetchCategoryProperty(categoryAncestor.getCategoryId(), "idContenido").getValue())!""/>
57 <#if contentId ? has_content>
58 <#assign journalArticleSub = journalArticleService.getLatestArticle(groupId,contentId)/>
59
60 <#if journalArticleSub?has_content>
61 <#-- obtener el contenido de la categoría actual -->
62 <#assign document = SAXReaderUtil.read(journalArticleSub.getContentByLocale(locale))
63 paginaDetalleNode = document.selectSingleNode("/root/dynamic-element[@name='paginaDetalle']/dynamic-content")
64 />
65
66 <#if document.selectSingleNode("/root/dynamic-element[@name='visibleMigas']/dynamic-content")?has_content>
67 <#assign visibleMigasNode = document.selectSingleNode("/root/dynamic-element[@name='visibleMigas']/dynamic-content")
68 visibleMigas = visibleMigasNode.getText()
69 hideCategory = visibleMigas != "1"/>
70 </#if>
71
72 <#if paginaDetalleNode?has_content && paginaDetalleNode.getText()?has_content>
73 <#assign pageDetail = paginaDetalleNode.getText()/>
74 <#if (pageDetail?index_of("@")>0)>
75 <#assign pageDetailPosition = (pageDetail?index_of("@")-1)
76 pageDetail = pageDetail[0..pageDetailPosition]
77 layoutDetail = layoutLocalService.getLayout(themeDisplay.getScopeGroupId(),false,pageDetail?number)
78 />
79 </#if>
80 </#if>
81 </#if>
82 </#if>
83 <#assign categoryUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE)/>
84 ${categoryUrl.setParameter("categoryId",categoryAncestor.getCategoryId()+"")}
85
86 <#if !(hideCategory?has_content && hideCategory)>
87 <#if categoryAncestor.isRootCategory()>
88 <#assign breadCrumbContent = "<li class='breadcrumb-item'><a href='"+categoryUrl+"'>"+languageUtil.get(locale,"webasturias.breadcrumb-portal")+" </a> </li>"+breadCrumbContent/>
89 <#else>
90 <#assign breadCrumbContent = "<li class='breadcrumb-item'><a href='"+categoryUrl+"'>"+categoryAncestor.getTitle(locale)+" </a> </li>"+breadCrumbContent/>
91 </#if>
92 </#if>
93 </#foreach>
94
95 ${breadCrumbContent}
96
97 </#if>
98 <#assign hideCategory = false/>
99 <li class="breadcrumb-item active">${category.getTitle(locale)}</li>
100 </#if>
101 </ol>
102</nav>
103
104<script type="text/javascript">
105 $( document ).ready(function() {
106 if(typeof ga !== "undefined") {
107 <#if category ? has_content>
108 var pageName = '${category.getName()}';
109 <#else>
110 var pageName = location.pathname;
111 </#if>
112 ga( 'send', 'pageview', {
113 'page': pageName,
114 'title': pageName
115 } );
116 }
117 });
118</script>