Using Video in internal collections - possible to hide blank entries?

jenmagjen Member Posts: 13

Lets say I have a list of items, each displayed on a dynamic page. In this collection, all the entries has unique ID, title, text, image, and some other information.

The issue:

Some entries may have a youtube-video, others not.

When using the video-widget, connected to this collection, the placeholder for the video is displayed even if the field for video-URL in the collection is empty.

Is there a way to "if" this out? Meaning that the video player only displays if the entry in the collection actually has a video-url?

Since Video is a collection-field-type and supports the Video widget, I find it quite surprising that this is not built-in functionality.

I hope someone can help me with a solution - or at least a work-around?



  • jenmagjen
    jenmagjen Member Posts: 13

    I made a custom widget to solve this. Still interested in an answer, however. :)

  • Aj_Cre8
    Aj_Cre8 Member Posts: 564 MVP

    @jenmagjen You can not hide certain parts of a Dynamic Page if a field is EMPTY. If that is the goal you are looking for. Anything on a Static "Dynamic Page" will show up. If the field is empty, then the placeholder image/text will be displayed. You could inject some code into the collection to either HIDE the whole row (if a field is empty) I believe, but if you do that, that entire row will be hidden, not just the video field.

  • community_manager
    community_manager Administrator Posts: 293 Duda Staff

    Very cool! Would love to see it (if you want to share it with us!) :)

  • jenmagjen
    jenmagjen Member Posts: 13


    Yes, I can make a bit more robust, and then share it. It's simple - uses the Plain Text input in a collection. Extracts the youtube (and later also Vimeo) ID - and inserts into an iframe with a responsive container.

    If the given URL in the collection is less than 8 chars (or whatever I put), it simply does not display anything.

    Just some really simple JS, combined with handlebars in the html-part.

    I'm considering making similar for Plain Text, Rich Text, perhaps images and links as well. In that way, dynamic pages can be built a bit more dynamic.

  • community_manager
    community_manager Administrator Posts: 293 Duda Staff
  • SassyK
    SassyK Member Posts: 4

    This is exactly the thing I need, hoping @Sheyla will share! Thank you, Sarah