[MGNLFE-230] DOC: Describe why and how to use site prototype for External SPA Created: 30/Jun/22  Updated: 03/Aug/22  Resolved: 03/Aug/22

Status: Closed
Project: Magnolia Frontend Helpers
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Christopher Zimmermann Assignee: Martin Drápela
Resolution: Done Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: PNG File image-2022-08-03-08-36-51-497.png    
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLFE-293 DOCSub: Why and how - other changes Sub-task Completed Martin Drápela  
MGNLFE-294 DOCSub: Why and how - main stuff Sub-task Closed Martin Drápela  
MGNLFE-295 DOCSub: Why and how (rv) Sub-task Completed Martin Drápela  
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Documentation update required:
Yes
Date of First Response:
Sprint: DevX 15
Story Points: 3

 Description   

A developper exploring and learning about Magnolia SPA will read https://docs.magnolia-cms.com/headless/spa-development/SPA-hosting.html#_externally_hosted_spa but will not learn about the best practice of configuring the baseUrl and routeTemplate on a site templatePrototype.

It would be helpful for them to learn this as a next step.

proposal

It can be a good practice to put the baseUrl and routeTemplate properties in the site templatePrototype, instead of in the template definition files. Remember, any properties in the site templatePrototype are applied to every page template in the site.

The key benefit is that you don't need to maintain the baseUrl and routeTemplate in all of your page templates, you can just maintain them in the site templateProtoype.

If you have multiple sites, this is very helpful as it allows you to reuse your page template definitions across all of your sites.

Example of a site configuration with an inline templateDefinition.

Link to the site / multisite documentation.

 

Other changes that I would recommend. 

Make a whole new section for Nextjs, not as a subsection of "Connecting an external SPA"

Change from CAUTION to INFO, this section: "For an external SPA, use spa as the value of the $type property in your page template definition......"


Generated at Mon Feb 12 05:45:29 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.