_index_ sitemap setup

Hi,

Currently we have setup a sitemap like the following for our experience pages in order to support 5 nested levels of folders and index pages and it works fine.

...
...
/_default_:
  jcr:primaryType: hst:sitemapitem
  hst:relativecontentpath: ${parent}/${1}
  /_default_:
    jcr:primaryType: hst:sitemapitem
    hst:relativecontentpath: ${parent}/${2}
    /_index_:
      jcr:primaryType: hst:sitemapitem
      hst:relativecontentpath: ${parent}/index
    /_default_:
      jcr:primaryType: hst:sitemapitem
      hst:relativecontentpath: ${parent}/${3}
      /_index_:
        jcr:primaryType: hst:sitemapitem
        hst:relativecontentpath: ${parent}/index
      /_default_:
        jcr:primaryType: hst:sitemapitem
        hst:relativecontentpath: ${parent}/${4}
        /_index_:
          jcr:primaryType: hst:sitemapitem
          hst:relativecontentpath: ${parent}/index
        /_default_:
          jcr:primaryType: hst:sitemapitem
          hst:relativecontentpath: ${parent}/${5}
          /_index_:
            jcr:primaryType: hst:sitemapitem
            hst:relativecontentpath: ${parent}/index
          /_any_:
            jcr:primaryType: hst:sitemapitem
            hst:relativecontentpath: ${parent}/${6}
...
...

Now, is there a way to simplify this so that we do not need to amend this whenever we receive the request from customer to support additional nested levels ? In other words, is there a way to support unlimited sitemap levels involving index pages (as I understand _any_ doesn’t allow _index_ to be its child).

Also, does _index_ sitemap item hst:relativecontentpath property supports placeholders (e.g. ${1}, ${2}, etc) other than ${parent} ? Have tried converting hst:relativecontentpath: ${parent}/index to hst:relativecontentpath: ${parent}/${2} in order to let the _index_ item to pick up the document with the same as that of folder name, but it didn’t work.

Thanks!

Cheers,
Selva

Hi Selva,

You can simplify the sitemap configuration to allow for any number of nested levels. You can use the _any_ wildcard along with the _index_ wildcard as a child.

/_any_:
  jcr:primaryType: hst:sitemapitem
  hst:componentconfigurationid: hst:pages/pagenotfound
  hst:relativecontentpath: xpages-root/${1}
  /_index_:
    jcr:primaryType: hst:sitemapitem
    hst:relativecontentpath: ${parent}/index
1 Like

Thanks @Adam_Pengh. That seems to be working when accessing xpage URLs directly (though https://documentation.bloomreach.com/14/library/concepts/hst-configuration-model/use-index-sitemap-items.html indicates that _index_ can’t be a children of _any_).

But, the xpage nested page structure is not displaying on the channel manager anymore. Also, (<@hst.link .../>) link generation suffixes the index pages with /index (e.g. http://localhost:8080/site/pages/level-1/index rather than http://localhost:8080/site/pages/level-1).

1 Like