Embedding an iframe within the text of a page

Hey all,

I’m trying to embed an iframe video into the the ‘temp2’ region of a few pages but every time I drag the iframe widget to that region, the page scrunches up to the left side and I am only able to add the widget to the right sidebar. I’ve also tried exploring regions to see if highlighting the target region would enable me to add the widget.

All the videos I’m working with are from youtube.

How can I embed these videos into the main text of my pages?

Thanks,
John

Hey John,

I can’t say what’s happening to your templates when you add the Iframe widget (sounds like a CSS issue), but it is fairly common to add YouTube videos directly into main content areas. To do this:

  1. Find the video on YouTube, and then follow the Share > Embed links below the video
  2. Copy out the YouTube Embed code (it’ll be a simple iframe tag with four attributes) and add descriptive text between the opening and closing iframe tags (or else the RTE will strip out the iframe)
  3. Open the content area in CM1 you want to add this video to, and from the toolbar, access Tools > Source Code
  4. From there, find the area in your content’s HTML code where you want this video to appear and paste in the YouTube code
  5. Save and verify in preview that everything appears as expected

Let me know if you have any trouble with this approach.

Hi Nate,

I should have mentioned that I tried that method after the iframe refused its new spot.

It shows up fine in the editor screen, I make a new paragraph for it to sit in and I can even watch the video. However, it disappears when I save the changes and doesn’t show up on the page.

Any ideas where to go from here?

Thanks,

Hi John,

My bad, it appears that the Rich Tex widget doesn’t support Iframes. My memory appears to be failing me! Instead, you’ll have to house the Iframe code into an HTML widget, which you can place below your Rich Text widget (you’ll have to add it on the template level). Let me know if this will work.

Hi Nate,

That works just fine, thanks for your help.

Scratch that Nate, we still have some issues.

The template used for the pages that I need to add video content too spans to other pages throughout the site. When I edit the template to include the html widget, all of the other sites pick it up as well.

other pages* pick it up…

Hi John,

If you add the widget to the template and leave it empty on the template, you should be able to add content to it or leave it blank on a page-by-page basis. Let me know if this isn’t working for you.

Yes, my memory has failed me. I recall now that YouTube allows you to select a “Use old embed code” option when pulling the embed code from videos. This code doesn’t use iframes, and will work within a Rich Text widget. I apologize for yanking you around on this one, John!

Don’t mention it, glad you followed up with this! I’ll give it a try. I’m having the same issue embedding this within a rich text box:

Any ideas?

Apparently YouTube has stopped providing the Old Embed Code.

Okay, my memory isn’t quite as bad as I thought – I’ve noticed that YouTube’s iframe embed tags are empty, which our RTE will see as blank content and strip out. If you simply add some fallback content between the iframe tags, it should work fine in the Rich Text editor.

For example, change this:


  


<iframe frameborder="0" height="315" src="//www.youtube.com/embed/UkqgD7TnLVE" width="560"></iframe>

  

To this:

  


<iframe frameborder="0" height="315" src="//www.youtube.com/embed/UkqgD7TnLVE" width="560">Video Title</iframe>

  

And it should work.