I have been making progress with upgrading to umbraco version 17, however, the blocks have been super confusing. For example, I followed what I could find on moving the views to a “templates/blockgrid/components/view.cshtml” with the instructed inherts. I then created a block based on an element type with the properties, and then created a single block based on that element. I then set the Grid Layout Rich Text Editors to allow blocks (adding one for test) and it just won’t render on the front-end. I’ve made sure the element alias matches the component view as well.
Surprisingly, I’m not finding much info on the web or forums on how to migrate from macro partials to blocks to be used.
Hi Jason,
Before diving in, just to make sure I point you in the right direction: are you embedding blocks inside a Rich Text Editor, or are you working with the Block Grid editor for page layouts?
The reason I ask is because the folder paths differ depending on the editor:
If you place RTE block views inside the Block Grid folder (or vice versa), they won’t render on the front-end and it can fail silently, which makes it confusing.
Based on what you described, it sounds like this might be the issue. the templates/blockgrid/components/ path you mentioned isn’t the typical/default rendering location in newer versions Umbraco usually resolves block views from Views/Partials/..., so that could be why it’s not rendering?
I’d also recommend checking the official docs here:: Blocks | CMS | Umbraco Documentation
/Bishal
macros are no longer supported. The recommended approach is to replace them with Blocks, built on Element Types and rendered via Block Grid or Block List editors.
Blocks are then configured in either:
Each block is rendered via a partial view instead of a macro:
So in practice, macros are replaced by Element Types + Block editors, and macro partial views are replaced by block component views.
Hi @jason-delaplain
I think the main issue converting macros to blocks is that there isn’t an out of the box solution for migrating the data so you will have to look at creating your own migrations. You would need to replace the macro markup with JSON for the blocks (whilst also migrating to the newer RTE JSON structure for TipTap.
The docs for the RTE blocks are here: Blocks | CMS | Umbraco Documentation
You also need to be putting your views into the folder:
~/Views/Partials/RichText/Components/{elementTypeAlias}.cshtml
And inheriting from:
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.RichTextBlockItem>
There’s a migration guide here which should help:
I know some people have had success using uSync migrations for this a well.
I hope that helps.
Regards,
Justin
Thank you all. I made great progress and figured it out. I’m on my way to finishing the version 17 upgrade. Thanks for the help.
1 Like