Extend and customize the Content list widget

Customize the widget designer

You can cutomize both the Listand the Details view of the Content list widget.

For more information, see Create custom views for the Content list widget.

Extend the widget

GITHUB EXAMPLE: You can find examples on how to extend the Model, ViewModel, View, and the Entity classes as part of the Quantum demo sample in Sitefinity GitHub repository:

For more information, see Extend the built-in widgets.

Exclude content types

Extend ContentListEntity

In order to exclude content types form the content list widget, you need to inherit and extend the ContentListEntity class and add TypeBlacklist paramater to exlclude content types or add Type paramater to specify a list of allowed contet types.

For example:

C#
using Progress.Sitefinity.AspNetCore;
using Progress.Sitefinity.AspNetCore.Widgets.Models.ContentList;
using Progress.Sitefinity.Renderer.Designers.Attributes;
using Progress.Sitefinity.Renderer.Entities.Content;

namespace SandboxWebApp.Entities
{
    /// <summary>
    /// Extended entity class for the ContentBlock view component.
    /// </summary>
    public class ExtendedContentListEntity : ContentListEntity
    {
        /// <inheritdoc />
        [ContentSection(Constants.ContentSectionTitles.SelectContentToDisplay, 0)]
        [Content(
            Type = $"{KnownContentTypes.ListItems}, {KnownContentTypes.News}",
            TypeBlacklist = "Telerik.Sitefinity.DynamicTypes.Model.PressReleases.Pressrelease"
        )]
        public override MixedContentContext SelectedItems
        {
            get
            {
                return base.SelectedItems;
            }
            set
            {
                base.SelectedItems = value;
            }
        }
    }
}

Register the entity

Then you need to register the entity in the Program.cs file:

builder.Services.AddSingleton<IEntityExtender, EntityExtender<ContentListEntity, SandboxWebApp.Entities.ExtendedContentListEntity>>();

Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.