Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

React Components // SPA // Url Shortening

sudesh_16
Level 2
Level 2

Hi,

 

We are creating react components based on SPA framework but we have extended it to be multi-page applications using react based component. Now we want to implement URL shortening. for that, we are creating a mapping in jcr resource resolver mapping and rewrite rules to hide "/content/XXX". Now when we are making a request to page without /content/XXX/en/abc.html like /en/abc.html then all calls are 200 included model.json for the page but the react components are not able to map it where if I make a request /content/XXX/en/abc.html then the same response is coming back but the page is getting rendered.

 

So is there i way that we can implement url shortening for react SPA framework(from official documentation, I understand that this feature is not supported OOTB) but is there any other alternative which we can use to implement the URL shortening.

 

Thanks,

Sudesh

React JS react-router SPA URL
1 Accepted Solution
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor
8 Replies
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor
shelly-goel
Community Advisor
Community Advisor

@sudesh_16To me it looks like the reverse mapping is not happening i.e. the subsequent requests are not mapped to the domain. Try adding Sling mappings (/etc/map entries) and that should hopefully take care of reverse mapping.

neerav_it
Level 2
Level 2

we have used vanity URL feature provided by AEM, worked pretty well for us

nasrinj31078225
Level 2
Level 2

@sudesh_16 , Did you get any solution for the issue? I am also facing same issue.

nasrinj31078225
Level 2
Level 2

Yes, I gave custom implemetation to the HierarchyPageImpl class and removed "/content/project-name/en" from getExportedPath() method if it is in publish mode. (fetch runmode slingSettingsService.getRunModes()).

Also removed  removed "/content/project-name/en" from all the routing links if it is in publish mode.

ryanarb
Level 1
Level 1

Thanks @nasrinj31078225 . What AEM and SPA version are you using? I think the latest one is not having HierarchyPage anymore.