Index: pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- pom.xml (revision 56475) +++ pom.xml (revision ) @@ -42,6 +42,7 @@ Hippo Plugin Robots.txt Generator 3.2.0-SNAPSHOT + 3.2.0-SNAPSHOT 1.1.2 @@ -66,6 +67,12 @@ + + org.onehippo.cms7 + hippo-repository-modules + ${hippo.repository.version} + provided + org.onehippo.cms7.hst hst-api Index: hst/src/main/java/org/onehippo/forge/robotstxt/components/RobotstxtComponent.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- hst/src/main/java/org/onehippo/forge/robotstxt/components/RobotstxtComponent.java (revision 56475) +++ hst/src/main/java/org/onehippo/forge/robotstxt/components/RobotstxtComponent.java (revision ) @@ -1,5 +1,5 @@ /** - * Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com) + * Copyright 2012-2015 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,10 @@ import java.util.List; import java.util.ArrayList; - import javax.jcr.Node; import javax.jcr.NodeIterator; import javax.jcr.RepositoryException; import javax.jcr.query.QueryManager; - import org.apache.jackrabbit.util.ISO9075; import org.hippoecm.hst.component.support.bean.BaseHstComponent; import org.hippoecm.hst.content.beans.standard.HippoBean; @@ -34,6 +32,8 @@ import org.hippoecm.hst.configuration.hosting.Mount; import org.onehippo.forge.robotstxt.annotated.Robotstxt; +import org.hippoecm.repository.jackrabbit.facetnavigation.FacNavNodeType; + public class RobotstxtComponent extends BaseHstComponent { @Override @@ -91,34 +91,44 @@ */ final String siteContentBase = mount.getContentPath(); - final String xpath = "/jcr:root" - + ISO9075.encodePath(siteContentBase) - + "//element(*,hippofacnav:facetnavigation)"; + final String xpath = "/jcr:root" + ISO9075.encodePath(siteContentBase) + + "//element(*," + FacNavNodeType.NT_FACETNAVIGATION + ")"; final QueryManager queryManager = request.getRequestContext().getSession().getWorkspace().getQueryManager(); final NodeIterator nodeIterator = queryManager.createQuery(xpath, "xpath").execute().getNodes(); final HstLinkCreator linkCreator = request.getRequestContext().getHstLinkCreator(); while (nodeIterator.hasNext()) { - Node node = nodeIterator.nextNode(); - HstLink link = linkCreator.create(node, request.getRequestContext()); + final Node node = nodeIterator.nextNode(); + // disallow all first level links below facet navigation + final NodeIterator facetChildNodesIterator = node.getNodes(); + while (facetChildNodesIterator.hasNext()){ + final Node facetChildNode = facetChildNodesIterator.nextNode(); + + if (!facetChildNode.isNodeType(FacNavNodeType.NT_FACETSAVAILABLENAVIGATION)){ + continue; + } + + final HstLink link = linkCreator.create(facetChildNode, request.getRequestContext()); + - if (link.isNotFound()) { - continue; - } + if (link.isNotFound()) { + continue; + } - if (link.getMount() != mount) { - /** - * Some projects combine the content of multiple sites into the same content tree. - * It may then happen that certain (faceted) content is only available on another - * site than the one for which robots.txt has been requested. In order to avoid that - * robots.txt ends up with links to different sites, we exclude such content here. - */ - continue; - } + if (link.getMount() != mount) { + /** + * Some projects combine the content of multiple sites into the same content tree. + * It may then happen that certain (faceted) content is only available on another + * site than the one for which robots.txt has been requested. In order to avoid that + * robots.txt ends up with links to different sites, we exclude such content here. + */ + continue; + } - // Link is suitable for rendering. - disallowedLinks.add(link); + // Link is suitable for rendering. + disallowedLinks.add(link); + } } } catch (RepositoryException e) { throw new HstComponentException(e); Index: hst/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- hst/pom.xml (revision 56475) +++ hst/pom.xml (revision ) @@ -45,6 +45,10 @@ org.apache.jackrabbit jackrabbit-jcr-commons + + org.onehippo.cms7 + hippo-repository-modules +