Expand my Community achievements bar.

Deep diving into Sling models PT5 | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

Deep diving into Sling models PT5 by Digitalum

Abstract

Part 5: Resources, resources everywhere!
In this blog post I will explain how I’ve managed to reuse existing components within other components, mitigating the need to copy/paste or even having to create a template for it.
The idea behind this blog post was inspired by a former team member who I used to work with at VRT.
If you’re reading this, Bert, I hope you remember that Section component for sporza.be, with the different layout options.
That component has made me re-think about how I can leverage the usage of Resources to reuse my components.

The traditional way of working
During the time you’ve been developing components for AEM, you have probably built some kind of component that would benefit from using an already existing component.
Let’s say we have an image component and we want to create an image with text component. How do you go about this?
If the scenario I just explained sounds familiar to you, go and have a look at how you’ve actually built that component before you read on. Then come back here and I’ll try to guess how you probably built that component by using my example of the image and image with text component.

All done? Let’s figure out if I was right or not!

You probably created a template out of the HTL you made for the image component, because that one has all the correct classes and everything and used that for both your image and image with text component. At first glance, that seems a pretty good and straightforward thing to do, since now we have only one place to manage the HTL for both of those components.

Read Full Blog

Deep diving into Sling models PT5

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies