A specific advanced list block type

Edit Mode and rendered output

Looks like this in Edit Mode All Properties:

The advanced list block type in Edit Mode All Properties

With the values above set, block renders like this:

Rendered output of the advanced list block type

Block type

Add a RekRecommendationsAdvancedBlock block type:

[SiteContentType(
    GUID = "C6AABF42-3082-49B6-8266-135A63A11828",
    GroupName = Globals.GroupNames.Rek,
    DisplayName = "Rek.ai Advanced List Recommendations",
    Description = "A block with the advanced render style, often used for news recommendations.")]
[SiteImageUrl("/gfx/block-type-thumbnail-rek-advanced.png")]
public class RekRecommendationsAdvancedBlock : SiteBlockData // Or just BlockData if outside of Alloy
{
    [Display(
        Name = "Headertext",
        Description = "A heading that is printed above the recommendations. Ex: “Recommended reading”.",
        Order = 1)]
    [CultureSpecific]
    public virtual string Headertext { get; set; }
 
    [Display(
        Name = "Subtree",
        Description = "The subtree to use for recommendations, if empty, the entire site is used. Ex: /science/,/accommodation/",
        Order = 2)]
    [CultureSpecific]
    public virtual string Subtree { get; set; }
 
    [Display(
        Name = "Only subpages to the currently visited page",
        Description = "Used instead of subtree and defaults to the URL of the page that is loading the block.",
        Order = 3)]
    [CultureSpecific]
    public virtual bool UseRootPath { get; set; }
 
    [Display(
        Name = "Number of hits",
        Description = "The maximum number of hits to display.",
        Order = 4)]
    [CultureSpecific]
    public virtual int Hits { get; set; }
 
    [Range(1, 3)]
    [Display(
        Name = "Number of columns",
        Description = "The number of columns to render: 1,2 or 3",
        Order = 5)]
    [CultureSpecific]
    public virtual int Columns { get; set; }
 
    [Display(
        Name = "Hide images",
        Description = "Makes sure that the hit's image is not rendered.",
        Order = 6)]
    [CultureSpecific]
    public virtual bool HideImage { get; set; }
 
    [Display(
        Name = "Fallback image",
        Description = "The image that is displayed if the article has no image.",
        Order = 7)]
    [CultureSpecific]
    [UIHint(UIHint.Image)]
    public virtual ContentReference FallbackImage { get; set; }
 
    [Display(
        Name = "Limit title length",
        Description = "The maximum number of characters to display of the title. If the title is longer it will add \"...\"",
        Order = 8)]
    [CultureSpecific]
    public virtual int TitleMaxLength { get; set; }
 
    [Display(
        Name = "Hide lead text",
        Description = "Makes sure that the hit's lead text is not rendered.",
        Order = 9)]
    [CultureSpecific]
    public virtual bool HideLead { get; set; }
 
    [Display(
        Name = "Limit lead text length",
        Description = "The maximum number of characters to display of the lead text. If the title is longer it will add \"...\"",
        Order = 10)]
    [CultureSpecific]
    public virtual int LeadMaxLength { get; set; }
 
    [Display(
        Name = "Advanced settings",
        Description = "Provides the opportunity to enter more parameters to the recommendation than what the interface offers. Ex: data-allowedlangs=\"se\" data-excludetree=\"/website-part-1,/website-part-2\"",
        Order = 11)]
    [CultureSpecific]
    [UIHint(UIHint.Textarea)]
    public virtual string AdvancedSettings { get; set; }
}

Block type thumbnail referenced by SiteImageUrl:

Thumbnail for the Rek.ai Advanced List Recommendations block type

View

Add a RekRecommendationsAdvancedBlock.cshtml file to Views/Shared/Blocks:

@model RekRecommendationsAdvancedBlock
 
@{
    var attributes = new Dictionary<string, string>
    {
        { "class", "rek-prediction" },
        { "data-renderstyle", "advanced" }
    };
 
    if (Model.Headertext != null)
    {
        attributes.Add("data-headertext", HttpUtility.HtmlEncode(Model.Headertext));
    }
 
    if (Model.Hits > 0)
    {
        attributes.Add("data-nrofhits", Model.Hits.ToString(CultureInfo.InvariantCulture));
    }
 
    if (Model.Columns > 0)
    {
        attributes.Add("data-cols", Model.Hits.ToString(CultureInfo.InvariantCulture));
    }
 
    if (!string.IsNullOrWhiteSpace(Model.Subtree) && !Model.UseRootPath)
    {
        attributes.Add("data-subtree", HttpUtility.HtmlEncode(Model.Subtree));
    }
    
    if (Model.UseRootPath)
    {
        attributes.Add("data-userootpath", "true");
    }
 
    if (Model.HideImage)
    {
        attributes.Add("data-hideimage", "true");
    }
    else if (Model.FallbackImage != null)
    {
        attributes.Add("data-fallbackimgsrc", Url.ContentUrl(Model.FallbackImage));
    }
 
    if (Model.TitleMaxLength > 0)
    {
        attributes.Add("data-titlemaxlength", Model.TitleMaxLength.ToString(CultureInfo.InvariantCulture));
    }
 
    if (Model.HideLead)
    {
        attributes.Add("data-showingress", "false");
    }
    else if (Model.LeadMaxLength > 0)
    {
        attributes.Add("data-ingressmaxlength", Model.LeadMaxLength.ToString(CultureInfo.InvariantCulture));
    }
 
    if (!isProduction
        && !string.IsNullOrWhiteSpace(siteSettings.RekProjectId)
        && !string.IsNullOrWhiteSpace(siteSettings.RekSecretKey))
    {
        attributes.Add("data-projectid", siteSettings.RekProjectId);
        attributes.Add("data-srek", siteSettings.RekSecretKey);
    }
 
    var advancedSettings = Model.AdvancedSettings != null ? " " + Model.AdvancedSettings : string.Empty;
}
 
<div @Html.Raw(string.Join(" ", attributes.Select(x => $"{x.Key}=\"{x.Value}\"")) + advancedSettings)></div>