Posting Youtube content

Topics: Enhanced Blog Edition
Mar 12, 2008 at 4:41 AM
Has anyone figured out how to post Youtube content? I click "edit HTML source" and paste in the Youtube embed object but it seems to get stripped out. Ideas?
Mar 12, 2008 at 3:35 PM
You can't do it like that as SharePoint strips out the object HTML.

You could do it with the XSL though. I don't know the exact code and haven't tried it, but it would go something like this...

When you edit the post change the pasted HTML in the HTML view...




hopefully SharePoint won't strip this. If it does try...


(if you have trouble editing the HTML have a look at this this)

The idea is to get SharePoint to store the correct data and to fix it in your XSL.

You can then modify the post.xsl to fix the <youtube>...</youtube> back to <object>...</object>

HTH, Vince

Mar 12, 2008 at 6:30 PM
Thank you for the tips. Sharepoint does indeed eat the <youtube> tag but it lets the ~youtube~ through so I'll start there. I also added this as a feature request in the "issue tracker" section. I'm not sure if that was the appropriate place but we'll see how far I get with implementation.
Mar 12, 2008 at 6:39 PM
Nope, put 'em in there and at least we won't forget it (which I won't because its on my list!!)

Mar 12, 2008 at 8:09 PM
Thanks Vince. I was just thinking about the rich text editor and how it's not necessarily web 2.0 ready. The Facebook editor recognizes hyperlinks, youtube videos, myspace sites, and so on. As you type a post or email in Facebook, it notices all the web content and creates rich links and summaries.

This is probably a much bigger topic than CKS:EBE. Maybe something that needs to be addressed on a Sharepoint or Office level but I fear the Rich Text Editor won't be sufficient.
Mar 12, 2008 at 8:21 PM
Edited Mar 12, 2008 at 8:22 PM
Just so you know...

Add the object in the HTML editor of the RichTextField...

{~object width='425' height='355'~}{~param name='movie' value=''~}{~/param~}{~param name='wmode' value='transparent'~}{~/param~}{~embed src='' type='application/x-shockwave-flash' wmode='transparent' width='425' height='355'~}{~/embed~}{~/object~}

Notice the double quotes are replaced with single quotes.

Modify post.xsl...

<xsl:stylesheet version="1.0"
xmlns:date="" xmlns:str=""
xmlns:xsl="" exclude-result-prefixes="date str">


<div class="blogText">
<xsl:variable name="tmp" select="str:replace(Body, '~}', '&gt;')"/>
<xsl:value-of select="str:replace($tmp, '{~', '&lt;')" disable-output-escaping="yes" />

Of course doesn't look great in the RSS feed, but if you are trimming the posts yu should be OK.