Copied to clipboard

Flag this post as spam?

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


  • Jeroen Oostwouder 103 posts 299 karma points
    Jun 07, 2022 @ 10:02
    Jeroen Oostwouder
    0

    HTML in a nested content name-template

    Hi there,

    I have a nestedcontent property on my site. Within the nested content element, there is a name and a color (via the eyedropper color picker).

    I can show the name in the name-template with

    {{ColorName}}
    

    I would like something like:

    <div style="background-color: {{ColorCode}};"></div> {{ColorName}}
    

    (with aditional css to make it a cube).

    But it only shows the name as plain text.

    Is it possible to add html/css somehow to this template?

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Mar 06, 2024 @ 20:46
    Heather Floyd
    0

    I'd like to do the same thing! Did you ever come up with a solution?

  • Jeroen Oostwouder 103 posts 299 karma points
    Mar 07, 2024 @ 07:16
    Jeroen Oostwouder
    0

    No, I never did. But since Umbraco 10 we use BlockLists instead of Nested Content (Nested Content will not be available from Umbraco 14 if I'm correct).

    With BlockLists you can make your own backoffice-template to show the element.

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Mar 07, 2024 @ 16:55
    Heather Floyd
    0

    Yes, I would be using it for BlockList, but with the "inline" view which also uses name templates. You are correct that using a custom display template would allow colors to be shown. I was just hoping to keep it a bit simple. 🙂

    Thanks for replying!

Please Sign in or register to post replies

Write your reply to:

Draft