Basically, I'm using Umbraco 4.7 and cannot get any macro to render on my site when added via the RTE. Upon inspecting the source, all I can see is something like:
Obviously the macro I was trying to render there was a contour form. However, I have gotten the same result when trying to output a macro as simple as listing the children of the current node.
I can avoid this problem by embedding the macro directly inside a new template but this is multiplying the number of templates/document types that should really be necessary and is proving rather cumbersome when all I want to do is add an individual macro to a particular page.
Anyone have a solution to this? Is this a new or known issue?
It renders fine from within viewing it inside the editor, just not on the site. Are you saying I simply can't add razor macros from the RTE and should make a specific template with them added instead, or that I need to use "umbraco.library.RenderMacroContent" ? If the former is true then perhaps in a future release the "add macro" option in the RTE should have some way of excluding macro's that depend on razor if they can't be added this way
You can't render a Contour form with umbraco.library.RenderMacroContent as it will not render properly. It would however be great if the support for rendering contour forms through razor could be added to 4.x as you sometimes are required to use razor to render contour forms if you want to create a well structured solution.
Razor macro not rendering when added via Richtext Editor
I don't think this has been asked before on this forum but I was wondering if anyone has encountered the problem highlighted here: http://stackoverflow.com/questions/5868578/umbraco-4-7-0-macro-not-rendering-when-inserted-via-richtext-editor .
Basically, I'm using Umbraco 4.7 and cannot get any macro to render on my site when added via the RTE. Upon inspecting the source, all I can see is something like:
<!--?UMBRACO_MACRO formguid="1caf0b16-ee5f-4f08-97c5-4116ac618698" macroAlias="umbracoContour.RenderForm" /-->
Obviously the macro I was trying to render there was a contour form. However, I have gotten the same result when trying to output a macro as simple as listing the children of the current node.
I can avoid this problem by embedding the macro directly inside a new template but this is multiplying the number of templates/document types that should really be necessary and is proving rather cumbersome when all I want to do is add an individual macro to a particular page.
Anyone have a solution to this? Is this a new or known issue?
Thanks,
Giles
Unfortunately, you can't render a macro in the richtext editor in another macro (your Razor macro).
See these posts for more information: http://our.umbraco.org/forum/umbraco-pro/contour/16794-Umbraco-Contour-No-macro-content-available-for-WYSIWYG-editing / http://our.umbraco.org/forum/developers/extending-umbraco/19003-macro-in-rich-text-editor-wont-work
Maybe you can use Razor to find the macro call and use the RenderMacroContent call to render it anyway.
It renders fine from within viewing it inside the editor, just not on the site. Are you saying I simply can't add razor macros from the RTE and should make a specific template with them added instead, or that I need to use "umbraco.library.RenderMacroContent" ? If the former is true then perhaps in a future release the "add macro" option in the RTE should have some way of excluding macro's that depend on razor if they can't be added this way
I think it should work when you put this in your template/masterpage (assuming your RTE is called bodyText):
The problem is that you can't directly render a macro from a macro (even in XSLT).
Works a treat. Thanks a lot
Just an update, you can get it to work in Razor as well, like this: http://our.umbraco.org/forum/developers/razor/21275-Rendering-RTE-with-embedded-macros-in-Razor
Comment author was deleted
You can't render a Contour form with umbraco.library.RenderMacroContent as it will not render properly. It would however be great if the support for rendering contour forms through razor could be added to 4.x as you sometimes are required to use razor to render contour forms if you want to create a well structured solution.
is working on a reply...