RenderMacro and MVC Razor

working with the 'Macro Container DataType' with MVC razor

Posted on Thursday, July 24, 2014

I earlier versions of Umbraco it seemed easy enough to use a Macro container as part of page template.


This outputed (for example):

 <?UMBRACO_MACRO macroalias="AccordianForTools" nodeId="1463" />

While upgrading a site to v.6.2.1 running MVC engine the @Umbraco.Field("renderMacro") within a page template (view) did not render anything.

Turns out there is an Umbraco Library helpers there is this method that can be used to display the macros from a macro container.


@Html.Raw(umbraco.library.RenderMacroContent(CurrentPage.renderMacro, CurrentPage.Id))

This is listed as an bug/issue :

(fix due in 6.2.2)