Wednesday, 18 June 2014

Making it easier to embed YouTube videos in your web content

We've just made some changes that will make it easier to add YouTube videos to pages in the CMS. You can now add videos to any content type that allows you to insert links, including standard page content, tabbed content, news and events.

To add a video, all you need to do is paste in a link to a YouTube video and assign a class to it of 'youtube-video-embed'. Your published page will then include the embedded video. The screenshots below show the steps in detail.

1. Paste in a link to a YouTube video


2. Use 'Insert/edit link' to set the class of the video to 'youtube-video-embed'


3. Done!

If you preview your page you'll now see your video embedded in your page. It will automatically resize to fill the width of your page.

A page preview showing the embedded video

As an added bonus, if you use this in a column that's too narrow for the embedded video to comfortably fit - for example in a three column layout or in a right hand column - then the video will be replaced with a thumbnail image instead. Clicking the thumbnail will take you to the full size video on YouTube.


A video in a narrow column automatically replaced with a thumbnail image


The old methods of embedding videos will still work. Full details can be found in the Web CMS Guide Wiki.

3 comments:

  1. Thanks Paul. Have previously come up against this and had to add videos underneath content rather than embedded within. Good news!

    ReplyDelete
  2. This is a good development, thanks. Will it work in things like News 2.0 pages?

    ReplyDelete
  3. James, sorry for the delay replying - comment notifications from the blog disappear into the ether sometimes.

    But in answer to your question, yes, this should work in any page.

    ReplyDelete