Sitecore 10 .NET Developer Certification — Question 37
Prior to the creation of any content items based on templates, you have taken over the creation of data templates from a previous Developer. Based on the design plan, two templates were created, ItemA and ItemB. Both templates have three identical fields: Title, Subtitle, and Description. Based on Sitecore best practices, how would you improve the template design?
Answer options
- A. Set the template for ItemB as a base template for ItemA and set the template for ItemA as the base template for ItemB to ensure proper inheritance.
- B. Set both templates to inherit from a new base template with the three duplicated fields, removing the fields from the existing templates.
- C. Delete the templates and start over again with new templates, one for the three duplicated fields and one for all the other fields from ItemA and ItemB.
- D. Set the template for ItemB as the base template for ItemA's template and delete the duplicated fields from ItemB's template.
Correct answer: B
Explanation
The correct answer is B because it centralizes the duplicated fields in a new base template, promoting better maintainability and adherence to best practices. Option A creates a circular dependency without addressing duplication, C unnecessarily discards existing work, and D complicates the structure by leaving ItemB with duplicated fields.