Based on what Google defines in Video sitemaps , There are some xml tags should be added to sitemaps for videos, and it should be like this:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>http://www.example.com/videos/some_video_landing_page.html</loc>
<video:video>
<video:thumbnail_loc>http://www.example.com/thumbs/123.jpg</video:thumbnail_loc>
<video:title>Grilling steaks for summer</video:title>
<video:description>Alkis shows you how to get perfectly done steaks every
time</video:description>
<video:content_loc>http://www.example.com/video123.mp4</video:content_loc>
<video:player_loc autoplay="ap=1">
http://www.example.com/videoplayer.mp4?video=123</video:player_loc>
<video:duration>600</video:duration>
<video:expiration_date>2009-11-05T19:20:30+08:00</video:expiration_date>
<video:rating>4.2</video:rating>
<video:view_count>12345</video:view_count>
<video:publication_date>2007-11-05T19:20:30+08:00</video:publication_date>
<video:family_friendly>yes</video:family_friendly>
<video:restriction relationship="allow">IE GB US CA</video:restriction>
<video:gallery_loc title="Cooking Videos">http://cooking.example.com</video:gallery_loc>
<video:price currency="EUR">1.99</video:price>
<video:requires_subscription>yes</video:requires_subscription>
<video:uploader info="http://www.example.com/users/grillymcgrillerson">GrillyMcGrillerson
</video:uploader>
<video:live>no</video:live>
</video:video>
I would like to know how is it possible to add these custom tags dynamically to my sitemap.xml?I am using mvcsitemapprovider
since the XML sitemap functionality was not the main purpose of MvcSiteMapProvider but an "extra" feature, it was not made very flexible.
I started working on creating a general purpose way to build (and page) XML sitemaps and support the full spec of Google (including videos). But realized that this should be a completely separate component than MvcSiteMapProvider, and never released it. You are welcome to take what you need from here.
well, I could not use the mvcsitemapprovider to achieve my goal yet, but I made this temporary solution and I am trying to make nuget package from it or add it as a feature to the mvcsitemapprovider package, here is the code I added to an ContentResult in a controller and I changed my routeConfig to call this method when the url is look like this "/videoSiteMap.xml" :
I replaced utf-16 with utf-8 while returning my xml data because I could not find an easier way to change XmlWriter's result (by default it always returns a utf-16 format)
I hope it help the others, I will be glad if someone help me to make it a nuget package or something :D