adobe / adobe/aem-spa-project-core

[feature] Mapped/short URLs in PageImpl

Open
#44 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
30
Forks
28
PR merge metrics
No merged PRs in 30d

Description

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:

```
{
return ;
}}
/>
```

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

Contributor guide

Open the contributing guide

Research direction

Start by examining the PageImpl model and how its page path is exposed to the React SSR router. Review the reported Jackson Module Provider and custom Remote Content Renderer Request Handler workaround for context. Done means the model exposes a mapped or short path that supports Sling mappings more complex than removing /content/site.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, react
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.