# Mapping content via prototype page in sitemap

**URL:** <https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [July 17, 2018, 11:45am UTC](https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157 "2018-07-17T11:45:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joeri](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/joeri/32/57_2.png) [@Joeri](https://community.bloomreach.com/u/Joeri)\
**Post date:** [July 17, 2018, 11:45am UTC](https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157/1 "2018-07-17T11:45:23Z")

</div>

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.

```
/hst:hst/hst:configurations/myproject/hst:prototypepages:
      jcr:primaryType: hst:pages
      /project-detail-page:
        jcr:primaryType: hst:component
        jcr:mixinTypes: ['hst:prototypemeta']
        hst:displayname: Project Detail Page
        hst:referencecomponent: hst:abstractpages/base
        /main:
          jcr:primaryType: hst:component
          hst:template: project-detail
          /container:
            jcr:primaryType: hst:containercomponent
            hst:xtype: hst.vbox

```

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

```
@Node(jcrType="myproject:projectdocument")
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 {  
@Override  
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](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 🙂

Thanks  
Cheers  
J

---

<div class="post-metadata">

**Author:** ![ThoLe](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/thole/32/98_2.png) [@ThoLe](https://community.bloomreach.com/u/ThoLe)\
**Post date:** [July 18, 2018, 2:47am UTC](https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157/2 "2018-07-18T02:47:17Z")

</div>

Hi,  
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!

---

<div class="post-metadata">

**Author:** ![Joeri](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/joeri/32/57_2.png) [@Joeri](https://community.bloomreach.com/u/Joeri)\
**Post date:** [July 18, 2018, 6:57am UTC](https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157/3 "2018-07-18T06:57:08Z")

</div>

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?

Cheers  
J

---

<div class="post-metadata">

**Author:** ![ThoLe](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/thole/32/98_2.png) [@ThoLe](https://community.bloomreach.com/u/ThoLe)\
**Post date:** [July 18, 2018, 7:13am UTC](https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157/4 "2018-07-18T07:13:47Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/167d3b2ace7b15c8cc5ec716f964bb801800520c.png)  
So any request to /site/place/placeA with be mapped to document with path content/places/placeA

---

<div class="post-metadata">

**Author:** ![lan.ims](https://avatars.discourse-cdn.com/v4/letter/l/e19b73/32.png) [@lan.ims](https://community.bloomreach.com/u/lan.ims)\
**Post date:** [September 30, 2018, 11:20am UTC](https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157/5 "2018-09-30T11:20:46Z")

</div>

Hi,  
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:

> **[Page Management - Bloomreach Experience - Open Source CMS](https://documentation.bloomreach.com/14/library/concepts/template-composer/page-management.html)**
>
> Open Source Enterprise Content Management

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

Thanks in advance

---

<div class="post-metadata">

**Author:** ![jasper.floor](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jasper.floor/32/28_2.png) [@jasper.floor](https://community.bloomreach.com/u/jasper.floor)\
**Post date:** [October 1, 2018, 8:28am UTC](https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157/6 "2018-10-01T08:28:25Z")

</div>

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 `www.example.org` then you can’t create a page at `www.example.org/place/placeA`. If your mount is at `www.example.org/place` then you can create that page, but not one deeper.

---

<div class="post-metadata">

**Author:** ![lan.ims](https://avatars.discourse-cdn.com/v4/letter/l/e19b73/32.png) [@lan.ims](https://community.bloomreach.com/u/lan.ims)\
**Post date:** [October 1, 2018, 4:14pm UTC](https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157/7 "2018-10-01T16:14:00Z")

</div>

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

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?

---

<div class="post-metadata">

**Author:** ![jasper.floor](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jasper.floor/32/28_2.png) [@jasper.floor](https://community.bloomreach.com/u/jasper.floor)\
**Post date:** [October 2, 2018, 8:34am UTC](https://community.bloomreach.com/t/mapping-content-via-prototype-page-in-sitemap/157/8 "2018-10-02T08:34:40Z")

</div>

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.

> **[HST Workspace Configuration - Bloomreach Experience - Open Source CMS](https://documentation.bloomreach.com/14/library/concepts/hst-configuration-model/workspace-configuration.html)**
>
> Open Source Enterprise Content Management
