[PAGES-1226] Make it possible to get subpath in site-aware SPA router Created: 12/Jun/23  Updated: 15/Sep/23  Resolved: 06/Sep/23

Status: Closed
Project: Magnolia pages module
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0, 6.2.31

Type: Improvement Priority: Neutral
Reporter: Robert Šiška Assignee: Rishab Dhar
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 3.5h Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Sub-Tasks:
Key
Summary
Type
Status
Assignee
PAGES-1227 Implementation Sub-task Completed Rishab Dhar  
PAGES-1228 Review Sub-task Completed Dai Ha  
PAGES-1229 Pre-Integration QA Sub-task Completed Robert Šiška  
PAGES-1230 QA Sub-task Closed Oanh Thai Hoang  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Date of First Response:
Epic Link: SPA Editor Backlog
Sprint: DevX 40, DevX 45
Story Points: 2
Team: DeveloperX
Work Started:

 Description   

If the site is defined for .e.g prefix /path/to/site, then in the `routeTemplaate` a new  property/variable:  `{{@sitePath}}` should return only the subpath

ie:  `/path/to/site/sub/path` → `/sub/path`

This would make it convenient for the frontend/SPA developer as the URL loaded in the Page Editor would be  the same to how it is loaded in the production frontend.

Note:

Keep in mind that even in the non-site context, frontends also need to usually handle two different routes, one for preview, and one for production. Consider the "react-minimal" demo project. For both of these URLs:

The SPA makes a delivery request to the full path http://delivery/react-minimal

Context

See: https://magnolia-cms.slack.com/archives/C02JTLP0CPP/p1686240443967409

 

Workaround:

The frontend app / SPA, can have routing logic to handle the the URL with the full path. (There might be situations where this is tricky.)

 



 Comments   
Comment by Robert Šiška [ 21/Jun/23 ]

Implemented on feature/6.3-norsu, reopened for backport for 6.2.

Comment by Martin Drápela [ 15/Sep/23 ]

DOC: I think already there. Initially imtroduced to norsu-only docs (feature/norsu branch): https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/product-docs/pull-requests/1639/commits/c6504bf9074dd2d340d9882f706ce8257df701d6#modules/ROOT/partials/developing/templating/r_spa-only-template-properties.adoc

Later appeared also in saas-docs: https://git.magnolia-cms.com/projects/CLOUD/repos/saas-docs/browse/modules/developers/pages/spa-development/templating/template-definition.adoc?useDefaultHandler=true#61,73-77

see now on https://docs.magnolia-cms.com/saas/developers/spa-development/templating/template-definition.html#_template_properties

Generated at Mon Feb 12 06:26:16 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.