If you have a lot of video content on the web, you will want to create a video sitemap to submit to Google and the other search engines. Here is a step-by-step tutorial on how to create a video sitemap with WordPress.
Some of these steps might not be appropriate for your situation, but I will start at the point where you have your video files (e.g. .M4V, .MP4, .MOV, .FLV, etc…) on a publicly-accessible web server somewhere and you have a fresh empty installation of WordPress also on a publicly-accessible web server.
Publish Video Posts
- Create a new post category and give it the name “video.”
- Create a new post, and add a custom field called “video_url.” This can either be done on a post-by-post basis or you can use a plugin to automatically create custom field forms such as Custom Field Template.
- Give the custom field the full URL value of your first video URL (e.g. http://www.yoursite.com/videofolder/video.m4v).
- Give the post the title of the video.
- If you have a transcript or some written content about the video write it in the WYSIWYG editor. This will be seen by anyone who visits your site and will be good for SEO purposes.
- Write a short description of the video in the Excerpt text box. DO NOT add any code or any character other than alphanumeric characters.
- If your theme allows for a featured image, add the featured image in that section. If not, you might choose to create another custom field and add the full URL value of the image location. It is recommended to make this image the same width and height of the video.
- Add relevant tags in the Post Tags section.
- Publish
- Repeat until all of your videos each have a unique post.
Create Custom XML Page
- In your theme directory where your index.php and style.css files exist, create a new file and call it video-sitemap.xml.
- Copy this code, and only this code, into video-sitemap.xml:
<!-- create a Video Sitemap template -->
<?php
/*
Template Name: Video Sitemap
*/
<!-- create a variable called $posts which is the contents of all of your video posts -->
$posts = query_posts(array_merge(
array(
'cat' => 'video',
'posts_per_page' => 9999,
'meta_key' => 'video_url'
)
));
<!-- this is the namespace of the XML file and the top of the file you will be producing -->
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
';
?>
<!-- loop to get each video and thumbnail URL, one at a time -->
<?php foreach ($posts as $post) {
$hosted_file_name = get_post_meta($post->ID, 'video_url', true);
if ( has_post_thumbnail() ) {
$videothumbnail = get_post_thumbnail ($post->ID);
}
?>
<!-- get video URL as its own element node along with the video attributes, and you must change the dummy URLs -->
<url>
<loc><?php echo the_permalink($post->ID); ?></loc>
<video:video>
<video:thumbnail_loc><?php echo $videothumbnail ?></video:thumbnail_loc>
<video:title><?php the_title(); ?></video:title>
<video:description><?php the_excerpt(); ?></video:description>
<video:content_loc><?php echo $hosted_file_name; ?></video:content_loc>
<video:player_loc>http://www.yourwebsite.com/file/path/yourflashplayer.swf</video:player_loc>
<video:publication_date><?php echo get_the_date('Y-m-d'); ?></video:publication_date>
<video:category>Here write the main content category of all of your videos</video:category>
<?php
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo '<video:tag>' . $tag->name . '</video:tag> ';
}
}
?>
<!-- this should be set to "no" if these are not suitable for kids -->
<video:family_friendly>yes</video:family_friendly>
</video:video>
</url>
<?php } ?>
</urlset>
- Save this file and uploaded it to the server
- Return to your WordPress dashboard and create a new page. Give it the title “Video Sitemap” so that the URL is http://www.yoursite.com/video-sitemap/.
- You will find a “Page Template” dropdown box. Choose “Video Sitemap” (which was declared at the top of the XML file you just created).
- Publish
There should now be a video sitemap at http://www.yoursite.com/video-sitemap/. You can submit this URL to Google Webmaster Tools as a sitemap.
In an earlier post I gave a primer on MusicXML as a way to create 





