_index_ question

Hi,

I have modelled a category page as a folder with a special file called “index” in it. The index file contains things like an title, introduction and metadata. Any other documents in the folder are rendered as the child pages of the category.

I have then added a sitemap entry using the index matcher:

/any:
jcr:primaryType: hst:sitemapitem
jcr:uuid: 82feae79-11ca-4fd3-a002-31849e965fb3
hst:componentconfigurationid: hst:pages/article
hst:relativecontentpath: {1} /_index_: jcr:primaryType: hst:sitemapitem jcr:uuid: 6dc074cb-7038-4d57-bda8-908ac5af946b hst:componentconfigurationid: hst:pages/category hst:relativecontentpath: {parent}/index

This seems to work well but I have noticed that links to the category (i.e. the index file in a folder) come out as “/mycategory/index” rather than to “/mycategory/”. The page is served at both /mycategory/ and at “/mycategory/index”

How can I ensure that links are generated as “/mycategory/”? (Or is my approach to modelling categories wrong?)

Thanks,

David

Which version are you using? This might be related to:

https://issues.onehippo.com/browse/HSTTWO-4575

We are using 13.3.0 so we should already have that bugfix?

Hi,

I think you should model your sitemap different, as documented on this page:
https://documentation.bloomreach.com/library/concepts/hst-configuration-model/use-index-sitemap-items.html

If you use a index sitemap and set the relative content path to the index file. Then /mycategory/ links to the correct index file and the links will be correctly generated.

Hi Leon,

I have done some more investigation and the issue seems to be that If I add index under a default sitemap entry everything behaves as I want.

The issue is that I want arbitrary depth categories and so I have used an any sitemap entry with a child index. When i do this urls are generated with the /index. On reading the docs it does mention that index cannot be a child of any.

I am not sure if there is a way to support arbitrary depth categories? In reality there is a limit to the depth we would create but it would nice to have a compact sitemap.

David

_any_ always consumes the rest of the path, so it can never have children. This doesn’t mean you cannot have arbitrary depth categories, just not using this mechanism. You could have an index document on a url without referencing that document. The component that serves the request merely needs to know it has to retrieve a document called index on its relative content path.

Hi David,

If you combine the default sitemap with the index sitemap then you only need the any sitemap. Perhaps as fallback. I would only use the any sitemap for folders where no landing pages are needed.

Hope this helps.