How can I insert a youtube embed link from a collection?

Hello, I am building a detail page for a collection. In this collection, the client wants to show youtube video’s on the page, showing how certain techniques work.

I can create a link field in the collection where the youtube link can go, but I am having trouble getting the youtube element to accept any of the collection fields as input.

I also tried to use a regular video element, but that does seem to be able to use a link as input for the video.
Lastly, I tried to use the html element; I thought I could perhaps fill that with the full youtube-embed code, but this also does not seem to accept the collection fields as input.

How can I get a youtube link to be embedded in an item page from a collection?

Thanks in advance for any and all suggestions!

Hey @Floris_van_Lint - not sure if I understood your issue correctly.

What I have just tested:

  • Open a collection item / blogpost
  • Edit CMS field
  • Added a YouTube-Element
  • Added a YouTube-Link
  • Rickrolled you a bit

Did you try this out?

1 Like

Hello @Andre no, I did not try that, I was trying to get the YouTube link directly in a YouTube element on the collection item page from a link field in the collection. But this seems like a good workaround, I will try it tomorrow. Thanks!

Edit:

Just to explain a bit better, I wanted to give the client a link field in the collection where they could simply enter their youtube url. I tried to connect that to the built-in youtube element or the uploaded video element, but both did not work as I had expected.
SCR-20220712-chb

Edit2:
The embedded CMS field is not as customer friendly as just entering the embed link. Regardless, this workaround does what we wanted. Thanks again @Andre!

Hey Floris,

The link field is “just” a link field that will display the link, but not embedd it. When you add a video element to the CMS field permanently, then it will only display when there is content in it.

So, you could add another CMS field named “video” or something and set it up in your collection item template. When your client does not use it it should not be shown in the actual blog post :slight_smile:

1 Like