[BLOSSOM-163] Template definition: set the "category" property Created: 05/Feb/14  Updated: 07/Nov/14  Resolved: 07/Feb/14

Status: Closed
Project: Blossom
Component/s: None
Affects Version/s: 2.0.3, 3.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jean-Charles Robert Assignee: Tobias Mattsson
Resolution: Workaround exists Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Magnolia 4.5.11


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:

 Description   

I am unable with Blossom to use the StkTemplatingFunctions siteRoot() method and all other methods that are using siteRoot()
A use case is for example the stkfn.homeLink(). There's also no possibility to easily inherit and access the homepage content.

The reason is that it needs the template category "home" in order to find the root of the site (usually the home page)
Unfortunately, it's not possible to set a category, and more generally to set any other parameters, in the template definition. Or did I miss something?



 Comments   
Comment by Tobias Mattsson [ 05/Feb/14 ]

Hi Jean-Charles,

The STKTemplatingFunctions assume that they're being used on pages using the STK templates. Categorizing templates is a feature of STK so the functions that rely on this will not work for pages not using STK templates. There's a number of ways you can deal with this if you need the siteRoot function,

  • either use an STK template for the site root, or
  • add a functions object of your own with a site root function that walks up the hierarchy until it finds the root based on a criteria of your own, or
  • extend STKTemplatingFunctions and override the siteRoot functions to use a strategy of your own

Inheritance can be done using the standard TemplatingFunctions which will work with templates not based on STK.

Comment by Jean-Charles Robert [ 06/Feb/14 ]

Hello Tobias,

Thank you for your answer!
I will then write my own site root function, that will find the root according to the template id.

Regards,
Jean-Charles

Generated at Sun Feb 11 23:30:46 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.