[DOCU-2457] Explain what the 'variations' property does Created: 14/Jun/21 Updated: 10/Oct/23 Resolved: 14/Jun/22 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Tobias Szczepanski | Assignee: | Ashraf Khamis |
| Resolution: | Done | Votes: | 0 |
| Labels: | external | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Documentation page URL: | https://docs.magnolia-cms.com/product-docs/Templating/Template-definition.html#_common_template_properties | ||||||||||||
| Reporter Name: | Tobias Szczepanski | ||||||||||||
| Email: | tobias.szczepanski@gmail.com | ||||||||||||
| Description |
|
Hi there, I just stumbled uppon this template definition property:
Technically it resides in info.magnolia.rendering.template.RenderableDefinition, but again the Java code is not documented at all. "Merges template definition with the variation having the same name of the channel - if available."
It would be really helpful to understand the intent behind these variations, maybe with a use-case example. Is it an alternative to the !include mechanism in yamls? Best |
| Comments |
| Comment by Richard Gange [ 14/Jun/21 ] |
|
Hello Tobias- Basically variations is similar to personalization. We used to have an example in the old demo. In that showcase there were different variations for viewport size. The different viewports resolves to 3 different channels: desktop, smartphone, tablet. In your template definition you could define a variation, for say smartphone, that would use a different script if a smartphone was detected. Same data, different script. This is just one example. I think the reason it stays in the documentation is for legacy reasons. Now you could use the personalization feature to do a lot of the same things.
That's right it's like a sub-definition of the template definition. You can literally change any configuration of the template based on the detected variation.
It could be anything. You the developer decided the names. Then you create a way (typically a filter) which detects the channel. For example a device detection filer. When detected you set the field in the agg state.
There are distinct systems. Neither depends on the other. They do similar types of things though.
Is the channel set in the agg state. That's how you would do it. Basically, was a channel detected, if yes then merge the definition with the defined variation (if a variation exists). It's kind of like how the template prototype merges with the concrete template. Same concept. HTH |
| Comment by Tobias Szczepanski [ 17/Mar/22 ] |
|
Hi Rich, great, thanks a bunch for the info! This is actually quite the valid use case, because technically personalization is only meant for template variants based on visitor/user preferences. Though one might need template variants based on system parameters, independent of the visitor/user. If I understand it right, we can achieve visitor independent Page & Component variants through As this is quite useful, I hope this feature will not be deprecated, will it? Best |
| Comment by Richard Gange [ 17/Mar/22 ] |
|
Hello Tobias- As far as I know there is no plan to deprecate it. HTH |
| Comment by Ashraf Khamis [ 14/Jun/22 ] |
|
Hi Tobias, Thanks for reporting the issue. I've updated the description for the variations property and added an example definition. Hope that helps. Best, Ashraf |
| Comment by Tobias Szczepanski [ 17/Jun/22 ] |
|
Hi Ashraf, great, thank you! |