@bipinch1 In that example i had set Structure Depth to 0, in spa template policy.
Here's what it looks like when set to 1:
{
"title": "English",
":itemsOrder": [],
":items": {...},
":path": "/en",
":type": "project/components/spa",
":children": {
"/en/home": {
"title": "Home",
":itemsOrder": [...],
":items": {...},
":path": "/en/home",
":type": "project/components/page",
":hierarchyType": "page"
},
"/en/about-us": {...},
"/en/what-we-do": {...},
"/en/platforms": {...},
"/en/our-work": {...},
"/en/careers": {...},
"/en/lets-talk": {...},
"/en/404": {...},
"/en/policies": {...}
},
":hierarchyType": "page"
}the page "en" uses the spa-root template while the rest use spa-page. As you can see it also captures the child pages pages on depth 1.
let's say I am on home and click on a link to "/en/platforms/subpage.html", a page that is not included on this initial root model:
Using the default /content/ path:
- It will fetch the required json (subpage.model.json)
- An add it to the router
- Page will be rendered on screen 😊
- Navigation is fine on all pages and subpages whatever the level.
However what happens now using the short path:
- It will fetch the required json, but using the short path
- The .model call is rewritten to include /content/...
- It will get the model, but the page is not added to the router resulting on a blank page.
- If I hit F5 i get both the root model and the subpage again, but the subpage is added to the router and renders fine (until i open another page that is not already on router).
Getting all the pages on the root model is not a possibility as it hinder the performance too much.
My suspicion is that this is a problem with Model Manager, any thoughts?
I made it work!
you need to change the URL root meta property on customheaderlibs to use the getRootUrl ( I was wondering what it was for ) from your custom model:
This is the default using spa core Page model
<meta
property="cq:pagemodel_root_url"
data-sly-use.page="com.adobe.aem.spa.project.core.models.Page"
content="${page.hierarchyRootJsonExportUrl}"
/>
Change it to your own function
<meta
property="cq:pagemodel_root_url"
data-sly-use.page="com.you.project.core.models.HierarchyPage"
content="${page.RootUrl}"
/>
It will work fine on publish now, but you also need modify the model so it doesn't short the path in author.
Thanks for the help, appreciated.