[feature] Mapped/short URLs in PageImpl
In a project when using React and SSR I'm having problems trying to use short URLs defined by sling mappings. The react router is configured to use the full page path provided by the PageImpl model. When using the dispatcher, the routes won't match the current page path showing a blank page.
It would be great if we can have an additional property with the mapped/short path too. Removing the initial /content/site is not enough when the sling mappings are more complex than just shortening the URL. Having this property would make really easy to modify the React route paths to consider the mapped path too:
<Route
key={routePath}
exact
path={['(.*)' + routePath + '(.' + extension + ')?', this.props.mappedPath]}
render={routeProps => {
return <WrappedComponent {...this.props} {...routeProps} />;
}}
/>
At the moment my workaround to this issue is implementing a Jackson Module Provider that adds a property containing the mapped path to the PageImpl model and a custom Remote Content Renderer Request Handler to configure the Object Mapper instance.
Other alternative is implementing our own Page model, but this basically means duplicating a lot of code that already exists here. The PageImpl class is not exported by the bundle so I can't extend it and reuse its logic.
Any thoughts or suggestions? Thanks
Thanks @dgonza - looks like we are facing the same issue, https://github.com/adobe/aem-spa-project-core/issues/43 seems to be the same.
@nhirrle yep, created almost at the same time too 😆 Aliases will be helpful as you've mentioned in #43