Copied to clipboard

Flag this post as spam?

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


  • rubenberendsen 13 posts 106 karma points
    Feb 16, 2021 @ 07:49
    rubenberendsen
    0

    Gridlayout Embed with cookiebot

    Hi all,

    I'm using in our website cookiebot en a gridlayout (with the editor Embed).

    I want to edit the iframe by adding 'data-cookieconsent' (https://support.cookiebot.com/hc/en-us/articles/360003790854-Iframe-cookie-consent-with-YouTube-example)

    Does anyone know how to fix this?

    Best regards,

    Ruben

  • Søren Kottal 713 posts 4571 karma points MVP 6x c-trib
    Feb 16, 2021 @ 08:03
    Søren Kottal
    0

    Hi Ruben

    The easiest way would be to simply search/replace it in.

    If you look at the default Embed view (Views/Partials/Grid/Embed.cshtml), it looks like this:

    @model dynamic
    @using Umbraco.Web.Templates
    @{
        string embedValue = Convert.ToString(Model.value);
        embedValue = embedValue.DetectIsJson() ? Model.value.preview : Model.value;
    }
    
    <div class="video-wrapper">
        @Html.Raw(embedValue)
    </div>
    

    You can change it so it looks like this:

    @model dynamic
    @using Umbraco.Web.Templates
    @{
        string embedValue = Convert.ToString(Model.value);
        embedValue = embedValue.DetectIsJson() ? Model.value.preview : Model.value;
        // add this
        embedValue = embedValue.Replace(" src=", "data-cookieconsent=\"marketing\" data-src=");
    }
    
    <div class="video-wrapper">
        @Html.Raw(embedValue)
    </div>
    
Please Sign in or register to post replies

Write your reply to:

Draft