Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Jeff Wallace
Sep 26, 2011
  4022
(2 votes)

Category Listing Composer Block

Based on CMS 6 R2, Composer 4 R2, and Composer 4 R2 Blocks

Earlier this month I wrote a blog about a Category Listing Dynamic Content Module which allows content authors to create listings based on one-to-many categories.  I also referenced a blog by Allan Thraen and his blog regarding using Page Providers to display an alternate navigation based on categories.  Continuing down this same path Jacob Kahn and I co-authored a Composer Block which borrows code from the Dynamic Content module to yield a Composer Block with similar functionality.

 

How do you use the Category Listing Composer Block?

The basics of how to use this are as follows.  After entering “Composer – Edit on Page” mode…

 

1) Select “Category Listing” from the Composer Toolbox Content Blocks.

image

2) Optionally enter a “Heading” for the listing.

3) Select the “StartPoint” for the area of the tree structure where you want the module to begin searching categories.

4) Enter one-to-many category names that the listing will be based on.

a) If a category exists in the system as you type it will be presented for you. Simply select it.

image

b) If you enter a category that is not already present in the system, select the “+” button, and it will be added below the category control as well as to the category list in the backend.

5) Optionally enter a “Start” and “End” date to filter the items in the listing based on the “Start publish” date. This is useful if you only want to list items that were published within a certain timeframe.

6) Select a “Sorting” order.

7) Select “ShowDate” if you want a date to be included in the listing.

8) Select “ShowPreviewText” if you want the preview text to be included in the listing.

image

 

9) Select “Save” to Save the settings.

10) Save the page by your preferred method (“Save and View”, etc)

 

image

 

11) View the result:

 

image

 

How do you set up the Category Listing Composer Block?

Great question.  A lot of people are using NuGet or EPiServer module files to deploy add-on modules these days.   Since this is a Composer block, a sample project existing that’s easy to add to, and maybe because I’m writing this on a Monday I’m going to provide the manual approach for the time being.  I may rethink this later and provide an updated blog.  For now, the steps are below and are based on the assumption that you’ve already set up a site with EPiServer CMS, Composer, and the Composer Blocks.

1) Download the code and import file.

2) Decompress the downloaded zip file with your tool of choice (Windows Explorer, WinZip, WinRar, etc).

3) Locate the “ComposerSampleTemplates” project. This file is typically located at your site installation path (e.g. C:\EPiServer\Sites\<mySiteName>\ComposerSampleTemplates.csproj).

4) Open the ComposerSampleTemplates.csproj file in Visual Studio.

5) In “Windows Explorer”, locate the CategoryListing folder that was extracted in step 2 above.

6) Add the entire contents of this folder to the ComposerSampleTemplates project in Visual Studio under the Composer\Functions folder path.  The easiest way to do this is probably to simply drag-and-drop the CategoryListing folder that was extracted from the zip file onto the Functions folder in your project.

image

7) Build the project.  This should update the assembly in the bin directory with the new code.

8) Navigate to EPiServer CMS Admin Mode.

9) Navigate to the “Admin” tab.

10) Select “EPiServer Composer – Import/Export”

image

11) Use the “Browse” button to locate the ContentListingComposerData.xml folder that was extracted in step 2 above.

image

12) Select the “Begin Import” button.

image

13) Assuming all is successful, this should add the “Category Listing” block to your list of “Block Types” for Composer which you can configure as you would any other Composer blocks.  See the EPiServer Composer documentation for more information on configuring Rules, Access Rights, etc.

image

 

You should now be able to use the Category Listing Composer Block as noted in the “How do you use the Category Listing Composer Block?” section above.

 

Please note, this is intended as a starting point for you to customize for your project needs. The code is provided “as is” without warranty or guarantee of operation. Use at your own risk. Good luck and enjoy!

Sep 26, 2011

Comments

Sep 26, 2011 11:13 PM

Very nice! Thanks and always quality work.

Please login to comment.
Latest blogs
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog