Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 939 posts 2574 karma points
    Jan 30, 2023 @ 12:03
    Claushingebjerg
    0

    Get data from Limbo Youtube in Razor

    Anybody know how to get values from the Limbo Youtube package in Razor.

    Docs say "This package features a property editor for inserting (via URL or embed code) a YouTube video. The property editor saves a bit of information about the video, which then will be availble in C#."

    but i'm in VS code, and dont have intelliwhtasitsname.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Jan 31, 2023 @ 22:45
    Nik
    0

    Hi Claus,

    Looking at the docs for the package if you added a property to your doc type called YouTube,

    In your razor view you could output the following:

    YouTubeValue? video = page.Value<YouTubeValue>("YouTube");
    
    if (!(video is null))
    {
    
    // Ender the embed iframe
    @video.Embed.Html
    
    // Render the video ID
    <pre>@video.Details.Id</pre>
    
    // Render other video information
    <pre>@video.Details.Title</pre>
    <pre>@video.Details.Duration</pre>
    <pre>@video.Details.Description</pre>
    }
    

    Src: Github Readme

    Hope that helps :-)

    Nik

Please Sign in or register to post replies

Write your reply to:

Draft