Learn how to automatically hide a video player element when the connected collection item has no video URL, instead of showing a default placeholder. This is useful when the page shows various collection items that contain multiple fields, and may or may not include a video.
In this tutorial we create a collection of minimal items, displayed in a repeater.
We'll use the following steps to create this functionality:
url.url field, and at least 1 item with an empty url field.repeater.url field.Add this code to your page to wait for the repeater items to load, and hide the video player in items that contain no video URL:
In edit mode, video players will show some default content even if they don't contain a video.
To test your implementation, preview your site.
In items with an empty url field, the video player will automatically collapse.