#Block Grid: Reusable layout template file

1 messages · Page 1 of 1 (latest)

drifting widget
#

I'm experimenting with the Block Grid feature and trying to understand how to set up various layouts. Currently, we use a Document Type Grid Editor that allows for a grid layout with four distinct column configurations:

Two columns with a 66% / 33% split
Two columns with an 83% / 16% split
Four columns, each 25% width
A single full-width column

I've created an element type for the layout and defined the Areas within the Block Grid settings. Additionally, I've made a corresponding .cshtml file for the element type that contains the following line:

@await Html.GetBlockGridItemAreasHtmlAsync(Model)
However, when I attempt to add another Block using the same element type to specify a different area layout, the option is disabled. I guess it is becuase I have already added that element type.

Do I need to create a separate element type and associated template file for each of my layout definitions, even though the template only includes the line @await Html.GetBlockGridItemAreasHtmlAsync(Model)?

Ideally, I'd like to be able to reuse the template for different layouts. Is this possible?

late atlas
#

Hey @drifting widget
I have made a dotnet new template called UmBootstrap that exemplifies most of what can be done with Block Grid and Block List.
You can install it as an example website with one click of a button in Visual Studio or a single command:
https://umbootstrap.com/

UmBootstrap is an Umbraco Website Starter Kit using Bootstrap Templates and a comprehensive Component Library all available for you to use in your projects

#

Please let me know if you need any further help but I am sure if you look at the back office and the code it will have everything you need.

drifting widget
#

Thanks, looking at your Partials/blockgrid/Components folder I see that you have mulitple layout files that are identitical. I guess there is no way to reuse the same file?