[PAGES-1308] AreaNodeHelper class getTemplateDefinition method does not consider the site template/prototype Created: 30/Aug/23  Updated: 25/Oct/23  Resolved: 20/Sep/23

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

Type: Bug Priority: Neutral
Reporter: Riste Drangovski Assignee: Dai Ha
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by PAGES-1315 JcrPagesDeliveryEndpoint does not con... Closed
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)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: Support
Team: DeveloperX

 Description   

info.magnolia.rendering.spa.renderer.AreaNodeHelper#getTemplateDefinition  supposed to get the template definition for a node.

Basically that works, but it does not consider the site template/prototype.

So if an area is defined in <Light Module>/template/pages/page.yaml, it is picked up correctly.

But if the area is defined in <Site>/templates/prototype/areas/, it is not picked up.



 Comments   
Comment by Christopher Zimmermann [ 30/Aug/23 ]

Hmmm. Not sure of the specifics of the problem here. But I know that I have used a site protoype to define an area on a spa project and it worked. That is, the area was configured and working correctly. (Maybe it is necessary for the prototype to be defined in YAML (rather than in JCR?))

Maybe this example helps: https://docs.magnolia-cms.com/headless/spa-development/SPA-hosting.html#_site_aware_external_spa

Comment by Dai Ha [ 31/Aug/23 ]

I would agree with Topher, AreaNodeHelper creates area nodes in spa context, and it is called inside template endpoints. If it is a site related page, it should be configured to use site spa when the overload AreaNodeHelper#createAreaNodes(javax.jcr.Node, java.util.Optional<info.magnolia.rendering.template.TemplateDefinition>, boolean) will take a "complete TemplateDefinition" from SiteAwareTemplateAnnotationEndpoint.
But yes, if in your use cases for some reason, AreaNodeHelper need to be called directly, we would love to hear more about it to see what we can do.
 

Comment by Dai Ha [ 31/Aug/23 ]

Link this problem with MAGNOLIA-9074, it is true that JcrPagesDeliveryEndpoint (jcrPagesDeliveryEndpoint_v2) does not aware of site template prototype since it use default AreaNodeHelper#createAreaNodes(javax.jcr.Node, boolean)? maybe this is ticket's use case?

Comment by Christopher Zimmermann [ 04/Sep/23 ]

rdrangovski Hey Riste - any thoughts on the above? Would be great if you can share what you are hoping to achieve / usecase.

Comment by Riste Drangovski [ 05/Sep/23 ]

Hi guys,
We are trying to override inherited components in the child pages. 
The concept is that we define components on root page, this components are inherited to 1st, 2nd child pages.
Then on 3rd level we want to overwrite this inherited components and new components (not inherited) to be then inherited to 4th, 5th ... child pages.
So for example all pages 3 level deep have same footer, then on some sub-trees we want different footers ...
The "BASF" person that reported this issue is on vacation, so I'm not able to provide more info until he is back, sorry.

Regards,
Riste

Comment by Christopher Zimmermann [ 05/Sep/23 ]

Thanks

Comment by Christopher Zimmermann [ 06/Sep/23 ]

Flag added

We wait for more input on the use case. 
In the meantime we fix known issue described in linked ticket PAGES-1315. Maybe the fix there will fix this issue.

Comment by Jochen Klein [ 18/Sep/23 ]

Hi, 

I am 'the BASF' guy

What we are tying to do is the following:

We have a page footer, hat is on every page. The footer in configured on the home page and the inherited onto every descendent page.
As the inheritance id for every page and every page type, our idea was, to define the footer area in the page template and not in the page yaml itself.
This way every page template will automatically get the correct area definition and in case of changes, we have a single point of maintenance.

As far as I can see, all of that is tackled in PAGES-1315. I looked at the PR and it seems, it covers our needs.
We will have to check as soon as we have access.

The PR also shows, how we can reuse the functionality (TempalteDefinitionHelper) in our code, which controls the inheritance / redefinition of the area.

Comment by Dai Ha [ 18/Sep/23 ]

Thanks jaklein for your reply. Indeed with PAGES-1315, the utility (AreaNodeHelper) is site-aware so I guess we can remove the flag on this ticket and also close it in flavor of PAGES-1315.

Comment by Dai Ha [ 20/Sep/23 ]

Close as duplicated with  PAGES-1315

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