Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • James J Hildeman 13 posts 104 karma points
    Oct 27, 2020 @ 04:32
    James J Hildeman
    0

    Umbraco v8.6.1 - Macros fail in RTE insert - even simplest

    PROBLEM: Even the simplest macro, such as a stock snippet like "List child nodes" fails to render appropriately and instead renders "Macro alias: ListOfChildPages".

    My template structure is... enter image description here My Macro structure is... enter image description here enter image description here My Content Structure with Macro inserted is... enter image description here

    My Result rendered on the public web page... Macro alias: ListOfChildPages

    What am I doing wrong? This seems like it should be so simple.

  • Huw Reddick 1746 posts 6111 karma points MVP c-trib
    Oct 27, 2020 @ 10:36
    Huw Reddick
    0

    Have you looked at it with your browser debug window open? it is possible that you are getting a 500 error from your macro but it is being hidden.

  • James J Hildeman 13 posts 104 karma points
    Oct 27, 2020 @ 16:05
    James J Hildeman
    0

    The debug window shows all 200 except a 307 (temp redirect) from two font files. The console log shows no errors. Pretty sure the macro is not being executed.

    Also, this happens with every macro I create on this new site. I worked my way back to using the stock snippet provided by umbraco to simplify as much as possible.

    It appears that "Html.GetGridHtml" is not executing the macro as part of it's rendering. Does a new version fix this? Afraid to update this close to a launch.

    Things I don't understand:

    1. "Macro alias: ListOfChildPages" showing on the public page. This is normally consumed when interpreting a macro.
    2. The macro will execute in the RTE editor if I turn that (2nd checkbox) "Render in ..." on. It will show up as the static output of the macro from my one last backoffice publish (i.e. not live executed, but executed back at publish time).
    3. I can find posts going back to v4 on how this is a problem. Is this a systemic problem that can't be solved? Somebody come out and say that if it is because I've burned much time already on this.
  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Oct 27, 2020 @ 16:13
    Marc Goodson
    100

    Hi James

    I think this issue goes 'way back'

    https://issues.umbraco.org/issue/U4-6206

    Essentially you are expected to insert Macros into a Rich Text Area OR the Grid (using a Macro Grid Editor) - but not necessarily inside a Rich Text Area that is inside the grid!

    So the workaround, would be for your grid cell to enable Macros to be inserted in the grid editor config, for the particular cell.

    And then in the editor, insert a Rich Text Area for any text to appear 'above the macro' then add a Macro editor - pick your macro - then add a further Rich Text Area, for any text that needs to appear below the Macro.

    regards

    Marc

  • James J Hildeman 13 posts 104 karma points
    Oct 28, 2020 @ 03:26
    James J Hildeman
    0

    I didn't understand your answer at first, but I think this is what you described in your solution. Correct?

    Check out the screen shot below. I went in and configured my "columns" in my "grid editor" to allow "Macros" instead of just "Rich Text Editor" and "Head Line" as they were defaulted to. As a result, the human editor can now have an 1) RTE, followed by 2) a "macro" followed by 3) RTE/Macro/Whatever! #OutOfBox

    Thanks Marc Goodson for your help! Hope this helps someone else.

    enter image description here

  • Huw Reddick 1746 posts 6111 karma points MVP c-trib
    Oct 27, 2020 @ 17:31
    Huw Reddick
    0

    I think it may depend on what the macro does. I have created simple html macro's that render ok in an RTE in the grid, however macro's with code I have not had any success in the rte

    Macro used in RTE in grid layout

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @{
        var lnkUrl = Model.MacroParameters["linkUrl"] != null ? Model.MacroParameters["linkUrl"] : "";
        var title = Model.MacroParameters["linkTitle"] != null ? Model.MacroParameters["linkTitle"] : "";
        var colour = Model.MacroParameters["linkColour"] != null ? Model.MacroParameters["linkColour"] : "";
    }
    <a class="btn btn-md @colour-btn linkbutton" role="button" href="@lnkUrl" >@title</a>
    

    As you can see it is a very simple macro.

  • James J Hildeman 13 posts 104 karma points
    Oct 28, 2020 @ 00:46
    James J Hildeman
    0

    Ya, it's not with the macro contents. The macro is not even executing. I need an Umbraco v8 version of "umbraco.library:RenderMacroContent()". Does anybody know what that is?

  • James J Hildeman 13 posts 104 karma points
    Oct 28, 2020 @ 03:20
    James J Hildeman
    0

    OK, I haven't worked extensively with Umbraco sense like v4.7. I still had "old thinking" going on and was tunnel-vision on "insert macro through RTE" solution. Turns out I solved it differently.

    Check out the screen shot below. I went in and configured my "columns" in my "grid editor" to allow "Macros" instead of just "Rich Text Editor" and "Head Line" as they were defaulted to. As a result, the human editor can now have an 1) RTE, followed by 2) a "macro" followed by 3) RTE/Macro/Whatever! #OutOfBox

    Thanks everyone for your help! Hope this helps someone else.

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft