I am building a AEM remote spa application with nextjs based on the repo https://github.com/adobe/aem-headless-app-templates/tree/main/nextjs-remotespa. This works absolutely fine. For each of the pages within ~/aem/wknd-app/ui.content/src/main/content/jcr_root/content/wknd-app/us/en/home in AEM Maven archtype project.
I need to add pages dynamically to the root home in AEM Spa editor, and then author to render it in nextjs app.
But when I add a page name 'foo' within home in AEM remote spa editor, and have a corresponding 'foo' page in Nextjs app, the contents are not loaded in both nextjs app and AEM spa editor. Only if i have a equivalent folder structure in AEM maven archtype project under ~/aem/wknd-app/ui.content/src/main/content/jcr_root/content/wknd-app/us/en/home as 'foo' folder and a .content.xml it works. Is there a way to dynamically add pages without adding folder structure in AEM Maven archtype project for remote spa? Any help in much appreciated.