3

My team is creating a new site using SXA and I am working on a page which will display a list of event locations and a list of events scheduled at each location. In the content tree, Events are items underneath the Location item.

We know how to display a list of event locations using a Page List using the process described here. Unfortunately, we can't seem to figure out how to add another another Page List to the event location Page List to display the events.

For the event location Page List, we have created a Variant Definition with a Placeholder which worked just fine. We have added a Page List to the the Placeholder and have been able to configure the second Placeholder to display a given set of data for each location. We can't, however, figure out how to either 1) display the child items of the location or 2) configure a query that takes the current item as a parameter.

We have already tried setting the Source Type on the event Page List to Children, but nothing is displayed.

2

In fact, you don't need Page List for this at all. Thanks to Rendering Variants and Query field which is available there you can render the whole tree of items on the page using just Page Content. All you need to do is to create proper queries.

For example:

enter image description here

Just put Page Content rendering on a home item and use bellow Items Tree variant for Page Content. It will render Title of Home item and then should render titles of child items.

  • SXA keeps popping up nice features that we didn't find yet - almost like a box of chocolates :) Although it is quite confusing to have a item list with page content instead of page list.. – Gatogordo Aug 4 '17 at 16:15
  • You should be also able to do the same with Page List. – Dawid Rutkowski Aug 4 '17 at 17:12
  • Ah... I think the light is starting to come on. I had tried to look up what adding a Query to a Rendering Variant did (here) but the documentation doesn't even mention it. If anyone has docs that do include it, please share! – Ben Stichter Aug 4 '17 at 17:17
  • 1
    Agree! We have some empty pages there, still, some features need to be documented. Be patient, work in progress:) – Dawid Rutkowski Aug 4 '17 at 19:04
  • No problem... my page is starting to come together! – Ben Stichter Aug 4 '17 at 19:18
0

The "children" option in the source type will list the children of the current item, which is in your case the item that displays the list - not the event location item. Assuming that the events are under the event location, you will not find them this way. (had to make a few assumptions here as it's not clear how your content is organized in Sitecore)

Another option is to use an "Item Query". That is a predefined query (under settings/item queries) that you are able to use in the page list (more info on my blog). But as you need the parent item as a parameter in the query, I don't see how this would match your requirement either - you can set a start point in a query, but I don't think you can make it configurable.

Next option could be not to use another page list, but fix it in the original variant definition (let that variant display the children). It won't work out of the box, but you might be able to get it done with a NVelocity template (intro on on M.West blog). Problem here is that you crossed the line to custom coding, and you should wonder if it won't be easier to create the necessary component in a custom way all together...

And actually, I'm afraid that might be the best answer for you. Create a custom rendering... Use variants in your custom rendering (blog) to make them easier to maintain. And add the rendering to the sxa system.

  • Sorry, yes, I should have made it clear that Events are organized as items under Event Locations. I've updated the question to be more clear. – Ben Stichter Aug 4 '17 at 16:11
  • We made the right assumptions - I'll keep my answer as reference, but go for the answer from @Dawid. He's on the sxa team so he knows all the gems :) – Gatogordo Aug 4 '17 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.