Mapping content via prototype page in sitemap

Another newbie question ;

I want to give editor/authors the possibility to create project pages, where they can put in random content and also put a dedicated “Project detail component” that renders specifics about “a project”.

For this I’ve created a prototype page with a container on it.

      jcr:primaryType: hst:pages
        jcr:primaryType: hst:component
        jcr:mixinTypes: ['hst:prototypemeta']
        hst:displayname: Project Detail Page
        hst:referencecomponent: hst:abstractpages/base
          jcr:primaryType: hst:component
          hst:template: project-detail
            jcr:primaryType: hst:containercomponent
            hst:xtype: hst.vbox

I’ve also created a document, to store project related content.

public class ProjectDocument extends BaseDocument {...}

This content is stored under /content/documents/myproject/projects/{name}

I wanted the controller to retrieve the content bean, via the url matching(sitemap)
@ParametersInfo(type = FeaturedProjectInfo.class)
public class FeaturedProjectComponent extends BaseHstComponent {
public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {
super.doBeforeRender(request, response);
final HstRequestContext ctx = request.getRequestContext();
// Retrieve the document based on the URL
ProjectDocument document = (ProjectDocument) ctx.getContentBean();

When browsing to http://localhost:8080/site/projects/sampleproject, the ctx.getContentBean() renders null.

So I assume it doesn’t know how to get the content based on the request and I need configuration in the sitemap.

When I look in hst:workspace > hst:sitemap there is a projects node, which has the sampleproject node. But there is no “hst:relativecontentpath” (there also is no mapping like any or any.html - this is related to the fact that I’m using a prototype page and the mapping is generated in hst:workspace?)

When I try this:
ctx.getSiteContentBaseBean().getBean("projects/sampleproject") I do find the HippoDocument.

After some debugging it looks like I can’t have a relative path null. (HstRequestContextImpl.class)
private HippoBean getBeanForResolvedSiteMapItem(ResolvedSiteMapItem resolvedSiteMapItem) {
String base = this.getSiteContentBasePath();
String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath());
if(relPath == null) {
log.debug(“Cannot return a content bean for relative path null for resolvedSitemapItem belonging to ‘{}’. Return null”, resolvedSiteMapItem.getHstSiteMapItem().getId());
return null;
} else {
return this.getHippoBean(base, relPath);

Not sure if I’m doing it the right way. I’m sure it can’t be the purpose that a cms editor starts messing in the cms/console.

Input appreciated :slight_smile:


If your page is related to a document then you need to setup the attribute hst:relativecontentpath in your hst:sitemapitem. So add new attribute hst:relativecontentpath with value as “projects/sampleproject” may be the solution.
Happy coding!

Thanks for your response.

Indeed, that seems to work, but I assume setting the hst:relativecontentpath in cms/console is not a task that a content editor will do.

Is there any way a content editor can link a content document to a path himself?


Of course the content editor is not the one setup that. But you may use the solution setting the content path as wildcard

So any request to /site/place/placeA with be mapped to document with path content/places/placeA

1 Like

if I create a sitemapitem like “place/default” the content editor can’t create a sub site like “place/placeA” because “place” exists in the fixed part of the sitemap. Which is explained here:

Is there another way to map content to page, created by a prototype page?

Thanks in advance

A wildcard like _default_ will not match if a more specific match like placeA exists. What page management won’t let you do is create urls that aren’t direct descendants of the mount. So if the mount is then you can’t create a page at If your mount is at then you can create that page, but not one deeper.

Nice thank you, I did know the mount is working like that. But it make sense :slight_smile:

Does this further mean that such a sitemapitem with _default_or _any_ works as a prototype for sitemapitems created via channel manager? Or are the sitemapitems in the channel and in workspace somehow merged, so that the relativecontentpath is set?

The sitemapitems created by the CM are separate and not based on the _default_ or _any_ wildcard matchers. The sitemap in the channel and workspace are indeed merged. If there are conflicts the workspace loses.