Umbraco Community BlockPreview

Hi,

I have added the following to my Program.CS file.

.AddBlockPreview(options =>
{
    options.BlockGrid = new()
    {
        Enabled = true,
        ContentTypes = ["button", 
            "embdedVideo", 
            "embed", 
            "expandingBox", 
            "faqHeader", 
            "faqListBox",
            "fileDownload",
            "formSelect",
            "galleryBlock",
            "GridImage",
            "GridImageWithLink",
            "inpageModel",
            "richText",
            "statistic",
            "headlineH1",
            "headlineH2",
            "headlineH3",
            "headlineH4",
            "headlineH5",
            "headlineH6",
            "footerFeatureBlock",
            "mainBlock",
            "blockWithImage",
            "blockWithText",
            "login"
        ],
        IgnoredContentTypes = [],
        ViewLocations = [],
        Stylesheets = []
    };

    options.BlockList = new()
    {
        Enabled = true,
        ContentTypes = [
            "faqListItem", 
            "fileDownloadItem", 
            "galleryItem",
            "helpSectionTopic",
            "helpSectionCategory",
            "staffMember"
        ],
        IgnoredContentTypes = [],
        ViewLocations = [],
        Stylesheets = []
    };

    options.RichText = new()
    {
        Enabled = true,
        ContentTypes = [],
        IgnoredContentTypes = [],
        ViewLocations = [],
        Stylesheets = []
    };
})

And I created the views in blocklist\Components

But when I go in to the back office I see the following:

It not showing the Block List Previerw.

I also put a brake point in defaukt.cshtm under \blocklist\

But it not hitting that brake point.

Can any one advise please.

Thanks
Darren

Hey Darren,

The views need to be placed in /Views/Partials/blocklist/Components/ you’re missing the Views/Partials/ part of the path, which is why the breakpoint is never hit; BlockPreview simply never finds the views to render them.

/Views/Partials/blocklist/Components/YourContentTypeAlias.cshtml

1 Like

Thank you that worked.