Displaying Collections for Liferay 7.2 and Earlier Versions
In versions before Liferay DXP 7.3+, collections were called content sets.
Content sets are primarily displayed through the Asset Publisher. It is currently the only method to display them out-of-the-box, but you can develop your own external applications or widgets to utilize content sets. In Creating Content Sets you created two content sets. Now display them on a page.
Configuring the Asset Publisher for Content Sets
To display the content sets, start with a blank page, and then add the necessary asset publishers and configure them to display the content sets.
-
Create a new home page for your site as a widget page with a 1 column layout. If you’re using a fresh Liferay DXP bundle, you can just remove the Hello World widget from the sample Home page.
-
Open the Add menu and add two Content Management → Asset Publishers to the page stacked vertically.
-
Click Options () → Configuration for the top asset publisher.
-
Under Asset Selection choose Content Set.
-
Open the Select Content Set and click Select.
-
Select the Space Program Images content set.
-
Click Save.
Now the images appear at the top of the page. You can manage the way the content is displayed—like what metadata appears—or even create a widget template to style the content, but the displayed items and the order in which they appear are determined by the content set.
Now configure the bottom asset publisher with the other content set.
-
Click Options () → Configuration for the bottom asset publisher.
-
Under Asset Selection choose Content Set.
-
Open Select Content Set and click Select.
-
Click on the Trending content set.
-
Click Save.
Again, you can manage various display settings, but the displayed items and their order are determined by the content set criteria.
Adding Items to an Existing Content Set
To demonstrate the management of both static and dynamic content sets, upload a new image, tag it, and add it to the static set manually.
-
Upload a new image and, under Categorization, tag it as trending.
-
The image is added to the top of the Trending content list.
-
To add it to the manual set, go back to Site Menu and navigate to Content & Data → Site Builder.
-
Click on Space Program Images or select → Edit next to Space Program Images.
-
Next to Asset Entries, click Select → Basic Document.
-
Select the new image and click Add.
-
Navigate back to the home page to see your image added to the list.
Content sets provide one place to define content and other assets to be displayed all over your site. Their reusability also means less repeated work involved in getting great content delivered to your users.