Expand my Community achievements bar.

SOLVED

Best practice for creating a large set of pages that share some content, but differ in layout.

Avatar

Level 3

I'm looking to create a feature similar to that of a calendar or news. My pages would have similar structure, e.g. fields like Title, Date, Location etc., but the components used on the page would differ. One page could be one column, another page could be two columns and a third page could be one column with an info box etc.

The similar structure led me to scaffolding, but given that the components differ, I don't see scaffolding working for me? 

So that leaves me with creating each page, dragging in the components and specifying their properties individually. For the previously mentioned fields, I would create something like a MetaDataComponent where Title, Date, Location etc. would be specified and then render the component (the field values are grouped in the same area). I would also need to create a listing of my pages, so would it be possible to retrieve the MetaDataComponent field values from the List component?

Or is there a 3rd and better way of doing it? :-)

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

What I would suggest is that you leverage resource type inheritance for your page components. The structure would look something like this:

/apps/myco/components/page/generic-calendar-page <-- this one has your custom dialog specifying title, date, and location

/apps/myco/components/page/one-column-calendar-page <-- this one has a super type of myco/components/page/generic-calendar-page (and no dialog)

/apps/myco/components/page/two-column-calendar-page <-- this one has a super type of myco/components/page/generic-calendar-page (and no dialog)

/apps/myco/components/page/three-column-calendar-page <-- this one has a super type of myco/components/page/generic-calendar-page (and no dialog)

Your templates would point to the one, two, and three column page components. There's no template which points directly at generic-calendar-page -- it's only function here is to provide a dialog used by the more specific layout page components. In a sense, it is similar to an abstract base class in Java.

Regards,

Justin

NOTE - with the new Responsive Grid feature in AEM 6.1, you may not need these individual "column" page components. But this is really a separate question from the one you asked.

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

Hi,

What I would suggest is that you leverage resource type inheritance for your page components. The structure would look something like this:

/apps/myco/components/page/generic-calendar-page <-- this one has your custom dialog specifying title, date, and location

/apps/myco/components/page/one-column-calendar-page <-- this one has a super type of myco/components/page/generic-calendar-page (and no dialog)

/apps/myco/components/page/two-column-calendar-page <-- this one has a super type of myco/components/page/generic-calendar-page (and no dialog)

/apps/myco/components/page/three-column-calendar-page <-- this one has a super type of myco/components/page/generic-calendar-page (and no dialog)

Your templates would point to the one, two, and three column page components. There's no template which points directly at generic-calendar-page -- it's only function here is to provide a dialog used by the more specific layout page components. In a sense, it is similar to an abstract base class in Java.

Regards,

Justin

NOTE - with the new Responsive Grid feature in AEM 6.1, you may not need these individual "column" page components. But this is really a separate question from the one you asked.