Skip to content

Commit

Permalink
Prevent the double display of the home page
Browse files Browse the repository at this point in the history
  • Loading branch information
fbourasse committed Dec 14, 2020
1 parent c568976 commit 61e9c90
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/main/resources/jmix_sitemap/txt/sitemap.sitemap.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</c:when>
<c:otherwise>
<c:set var="siteMapNode" value="${currentNode}"/>
<c:url value="${url.base}${currentNode.path}.html"/>
</c:otherwise>
</c:choose>

Expand All @@ -19,8 +20,6 @@
<query:descendantNode path="${siteMapNode.path}" selectorName="stmp"/>
</jcr:jqom>

<c:url value="${url.base}${currentNode.path}.html"/>
<c:forEach items="${sitemaps.nodes}" varStatus="status" var="sitemapEL">
<c:url value="${url.base}${sitemapEL.path}.html"/>

</c:forEach>
17 changes: 9 additions & 8 deletions src/main/resources/jmix_sitemap/xml/sitemap.sitemap.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,28 @@
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

<jcr:nodeProperty node="${currentNode}" name="jcr:lastModified" var="lastModif"/>

<c:choose>
<c:when test="${(currentNode.name == 'home')}">
<c:set var="siteMapNode" value="${currentNode.parent}"/>
</c:when>
<c:otherwise>
<c:set var="siteMapNode" value="${currentNode}"/>
<url>
<loc>${serverUrl}<c:url value="${url.base}${currentNode.path}.html"/></loc>
<lastmod><fmt:formatDate value="${lastModif.date.time}" pattern="yyyy-MM-dd"/></lastmod>
<changefreq>${currentNode.properties.changefreq.string}</changefreq>
<priority>${currentNode.properties.priority.string}</priority>
</url>
</c:otherwise>
</c:choose>

<jcr:jqom var="sitemaps">
<query:selector nodeTypeName="jmix:sitemap" selectorName="stmp"/>
<query:descendantNode path="${siteMapNode.path}" selectorName="stmp"/>
</jcr:jqom>

<c:choose>
<c:when test="${((pageContext.request.scheme == 'http') && (pageContext.request.serverPort == 80)) || (pageContext.request.scheme == 'https') && (pageContext.request.serverPort == 443)}">
<c:set var="serverUrl" value="${pageContext.request.scheme}://${pageContext.request.serverName}"/>
Expand All @@ -31,14 +40,6 @@
</c:otherwise>
</c:choose>

<jcr:nodeProperty node="${currentNode}" name="jcr:lastModified" var="lastModif"/>
<url>
<loc>${serverUrl}<c:url value="${url.base}${currentNode.path}.html"/></loc>
<lastmod><fmt:formatDate value="${lastModif.date.time}" pattern="yyyy-MM-dd"/></lastmod>
<changefreq>${currentNode.properties.changefreq.string}</changefreq>
<priority>${currentNode.properties.priority.string}</priority>
</url>

<c:forEach items="${sitemaps.nodes}" varStatus="status" var="sitemapEL">
<jcr:nodeProperty node="${sitemapEL}" name="jcr:lastModified" var="lastModif"/>
<url>
Expand Down

0 comments on commit 61e9c90

Please sign in to comment.