Version Description
- fixed - Plugin now supports multiple videos embedded in the same page or post. This was earlier giving a "duplicate content" error in Google Webmaster Tools but, thanks to a suggestion by @blogdna, the problem is now fixed.
- added - Plugin compatible with WordPress 3.3.1
Download this release
Release Info
Developer | labnol |
Plugin | Google XML Sitemap for Videos |
Version | 2.4 |
Comparing to | |
See all releases |
Code changes from version 2.3.1 to 2.4
- readme.txt +6 -2
- video-sitemap.php +15 -13
- video-sitemap.xsl +40 -40
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: labnol
|
3 |
Tags: youtube, xml sitemaps, google sitemaps, videos, seo, sitemaps, video sitemap
|
4 |
Requires at least: 2.9.2
|
5 |
-
Tested up to: 3.1
|
6 |
-
Stable tag: 2.
|
7 |
|
8 |
This plugin will help you generate Google Video Sitemaps (XML) for your WordPress blog.
|
9 |
|
@@ -62,6 +62,10 @@ The Sitemaps protocol enables you to let search engines know what content you wo
|
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
|
|
65 |
= 2.3.1 =
|
66 |
* added - Support for IFRAME based YouTube embeds
|
67 |
* fixed - Improved discovery code for YouTube videos
|
2 |
Contributors: labnol
|
3 |
Tags: youtube, xml sitemaps, google sitemaps, videos, seo, sitemaps, video sitemap
|
4 |
Requires at least: 2.9.2
|
5 |
+
Tested up to: 3.3.1
|
6 |
+
Stable tag: 2.4
|
7 |
|
8 |
This plugin will help you generate Google Video Sitemaps (XML) for your WordPress blog.
|
9 |
|
62 |
|
63 |
== Changelog ==
|
64 |
|
65 |
+
= 2.4 =
|
66 |
+
* fixed - Plugin now supports multiple videos embedded in the same page or post. This was earlier giving a "duplicate content" error in Google Webmaster Tools but, thanks to a suggestion by @blogdna, the problem is now fixed.
|
67 |
+
* added - Plugin compatible with WordPress 3.3.1
|
68 |
+
|
69 |
= 2.3.1 =
|
70 |
* added - Support for IFRAME based YouTube embeds
|
71 |
* fixed - Improved discovery code for YouTube videos
|
video-sitemap.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google XML Sitemap for Videos
|
|
4 |
Plugin URI: http://www.labnol.org/software/xml-video-sitemaps-for-google/14085/
|
5 |
Description: This plugin will generate a XML Video Sitemap for your WordPress blog. Open the <a href="tools.php?page=video-sitemap-generate-page">settings page</a> to create your video sitemap.
|
6 |
Author: Amit Agarwal
|
7 |
-
Version: 2.
|
8 |
Author URI: http://www.labnol.org/
|
9 |
*/
|
10 |
|
@@ -58,15 +58,17 @@ exit();
|
|
58 |
?>
|
59 |
|
60 |
<div class="wrap">
|
61 |
-
<div style="float:right; margin:10px">
|
62 |
-
<iframe src="http://www.facebook.com/plugins/likebox.php?id=5791561181&width=250&height=260&connections=8&stream=false&header=false" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:250px; height:260px"></iframe>
|
63 |
-
</div>
|
64 |
<h2>XML Sitemap for Videos</h2>
|
65 |
<?php $sitemapurl = get_bloginfo('home') . "/sitemap-video.xml"; ?>
|
66 |
<p>The XML Sitemap was generated successfully. Please open the <a target="_blank" href="<?php echo $sitemapurl; ?>">Sitemap file</a> in your favorite web browser to confirm that there are no errors.</p>
|
67 |
<p>You can submit your Video XML Sitemap through <a href="http://www.google.com/webmasters/tools/" target="_blank">Webmaster Tools</a> or you can directly <a target="_blank" href="http://www.google.com/webmasters/sitemaps/ping?sitemap=<?php echo $sitemapurl; ?>">ping Google</a>.</p>
|
68 |
-
<h3>
|
69 |
-
<p>Please email your suggestions to Amit Agarwal at amit@labnol.org. You can also connect with <a href="http://www.labnol.org/" target="_blank">Digital Inspiration</a> on <a href="http://twitter.com/labnol" target="_blank">Twitter</a> and <a href="http://www.facebook.com/digital.inspiration" target="_blank">Facebook</a>. </p>
|
|
|
|
|
|
|
|
|
|
|
70 |
<?php } else { ?>
|
71 |
<div class="wrap">
|
72 |
<h2>XML Sitemap for Videos</h2>
|
@@ -80,9 +82,7 @@ exit();
|
|
80 |
</div>
|
81 |
</form>
|
82 |
<p>You can click the button above to generate a Video Sitemap for your website. Once you have created your Sitemap, you should submit it to Google using Webmaster Tools. </p>
|
83 |
-
|
84 |
-
<p>Please email your suggestions to Amit Agarwal at amit@labnol.org.</p>
|
85 |
-
<p> You can also connect with <a href="http://www.labnol.org/" target="_blank">Digital Inspiration</a> on <a href="http://twitter.com/labnol" target="_blank">Twitter</a> and <a href="http://www.facebook.com/digital.inspiration" target="_blank">Facebook</a>. </p>
|
86 |
</div>
|
87 |
<?php }
|
88 |
}
|
@@ -111,14 +111,16 @@ function video_sitemap_loop () {
|
|
111 |
$videos = array();
|
112 |
|
113 |
foreach ($posts as $post) {
|
|
|
114 |
if (preg_match_all ("/youtube.com\/(v\/|watch\?v=|embed\/)([a-zA-Z0-9\-_]*)/", $post->post_content, $matches, PREG_SET_ORDER)) {
|
115 |
|
116 |
$excerpt = ($post->post_excerpt != "") ? $post->post_excerpt : $post->post_title ;
|
117 |
$permalink = get_permalink($post->id);
|
118 |
|
119 |
-
|
120 |
|
121 |
$id = $match [2];
|
|
|
122 |
|
123 |
if (in_array($id, $videos))
|
124 |
continue;
|
@@ -130,8 +132,8 @@ function video_sitemap_loop () {
|
|
130 |
$xml .= " <video:video>\n";
|
131 |
$xml .= " <video:player_loc allow_embed=\"yes\" autoplay=\"autoplay=1\">http://www.youtube.com/v/$id</video:player_loc>\n";
|
132 |
$xml .= " <video:thumbnail_loc>http://i.ytimg.com/vi/$id/2.jpg</video:thumbnail_loc>\n";
|
133 |
-
$xml .= " <video:title>" . htmlspecialchars($post->post_title) . "</video:title>\n";
|
134 |
-
$xml .= " <video:description>" . htmlspecialchars($excerpt) . "</video:description>\n";
|
135 |
|
136 |
if ($_POST['time'] == 1) {
|
137 |
$duration = youtube_duration ($id);
|
@@ -192,4 +194,4 @@ function youtube_duration ($id) {
|
|
192 |
return '0';
|
193 |
}
|
194 |
}
|
195 |
-
?>
|
4 |
Plugin URI: http://www.labnol.org/software/xml-video-sitemaps-for-google/14085/
|
5 |
Description: This plugin will generate a XML Video Sitemap for your WordPress blog. Open the <a href="tools.php?page=video-sitemap-generate-page">settings page</a> to create your video sitemap.
|
6 |
Author: Amit Agarwal
|
7 |
+
Version: 2.4
|
8 |
Author URI: http://www.labnol.org/
|
9 |
*/
|
10 |
|
58 |
?>
|
59 |
|
60 |
<div class="wrap">
|
|
|
|
|
|
|
61 |
<h2>XML Sitemap for Videos</h2>
|
62 |
<?php $sitemapurl = get_bloginfo('home') . "/sitemap-video.xml"; ?>
|
63 |
<p>The XML Sitemap was generated successfully. Please open the <a target="_blank" href="<?php echo $sitemapurl; ?>">Sitemap file</a> in your favorite web browser to confirm that there are no errors.</p>
|
64 |
<p>You can submit your Video XML Sitemap through <a href="http://www.google.com/webmasters/tools/" target="_blank">Webmaster Tools</a> or you can directly <a target="_blank" href="http://www.google.com/webmasters/sitemaps/ping?sitemap=<?php echo $sitemapurl; ?>">ping Google</a>.</p>
|
65 |
+
<h3>Stay Connected</h3>
|
66 |
+
<p>Please email your suggestions to Amit Agarwal at amit@labnol.org. You can also connect with <a href="http://www.labnol.org/" target="_blank">Digital Inspiration</a> on <a href="http://twitter.com/labnol" target="_blank">Twitter</a>, <a href="http://www.youtube.com/labnol" target="_blank">YouTube</a> and <a href="http://www.facebook.com/digital.inspiration" target="_blank">Facebook</a>. </p>
|
67 |
+
<p><a href="https://twitter.com/labnol" class="twitter-follow-button" data-show-count="true" data-lang="en" >Follow @labnol</a></p>
|
68 |
+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
69 |
+
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fdigital.inspiration&send=false&layout=standard&width=500&show_faces=true&action=recommend&colorscheme=light&font=arial&height=80&appId=197498283654348" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:80px;" allowTransparency="true"></iframe>
|
70 |
+
|
71 |
+
<hr />
|
72 |
<?php } else { ?>
|
73 |
<div class="wrap">
|
74 |
<h2>XML Sitemap for Videos</h2>
|
82 |
</div>
|
83 |
</form>
|
84 |
<p>You can click the button above to generate a Video Sitemap for your website. Once you have created your Sitemap, you should submit it to Google using Webmaster Tools. </p>
|
85 |
+
<code>This WordPress plugin was developed by <a href="http://www.labnol.org/about/">Amit Agarwal</a> of <a href="http://www.labnol.org/">Digital Inspiration</a>.</code>
|
|
|
|
|
86 |
</div>
|
87 |
<?php }
|
88 |
}
|
111 |
$videos = array();
|
112 |
|
113 |
foreach ($posts as $post) {
|
114 |
+
$c = 0;
|
115 |
if (preg_match_all ("/youtube.com\/(v\/|watch\?v=|embed\/)([a-zA-Z0-9\-_]*)/", $post->post_content, $matches, PREG_SET_ORDER)) {
|
116 |
|
117 |
$excerpt = ($post->post_excerpt != "") ? $post->post_excerpt : $post->post_title ;
|
118 |
$permalink = get_permalink($post->id);
|
119 |
|
120 |
+
foreach ($matches as $match) {
|
121 |
|
122 |
$id = $match [2];
|
123 |
+
$fix = $c++==0?'':' [Video '. $c .'] ';
|
124 |
|
125 |
if (in_array($id, $videos))
|
126 |
continue;
|
132 |
$xml .= " <video:video>\n";
|
133 |
$xml .= " <video:player_loc allow_embed=\"yes\" autoplay=\"autoplay=1\">http://www.youtube.com/v/$id</video:player_loc>\n";
|
134 |
$xml .= " <video:thumbnail_loc>http://i.ytimg.com/vi/$id/2.jpg</video:thumbnail_loc>\n";
|
135 |
+
$xml .= " <video:title>" . htmlspecialchars($post->post_title) . $fix . "</video:title>\n";
|
136 |
+
$xml .= " <video:description>" . $fix . htmlspecialchars($excerpt) . "</video:description>\n";
|
137 |
|
138 |
if ($_POST['time'] == 1) {
|
139 |
$duration = youtube_duration ($id);
|
194 |
return '0';
|
195 |
}
|
196 |
}
|
197 |
+
?>
|
video-sitemap.xsl
CHANGED
@@ -1,40 +1,40 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<xsl:stylesheet version="2.0"
|
3 |
-
xmlns:html="http://www.w3.org/TR/REC-html40"
|
4 |
-
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
5 |
-
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
|
6 |
-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
7 |
-
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
8 |
-
<xsl:template match="/">
|
9 |
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
10 |
-
<head>
|
11 |
-
<title>
|
12 |
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
13 |
-
<style type="text/css">
|
14 |
-
body{font-family:Arial,sans-serif;font-size:11px;margin:0;padding:0}.labnol{margin:10px;float:left;border-top-width:1px;border-right-width:2px;border-bottom-width:2px;border-left-width:1px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:#CCC;border-right-color:#CCC;border-bottom-color:#CCC;border-left-color:#CCC;width:350px;height:110px;overflow:hidden;padding-top:5px;padding-right:5px;padding-bottom:10px;padding-left:5px}.labnol h1{font-family:Georgia,"Times New Roman",Times,serif;font-size:1.2em;margin:0;padding:0 0 5px}.labnol h1 a{text-decoration:none;color:#333}.labnol p{color:#666;margin:0px;padding-top:10px}.labnol img{float:right;padding-top:0;padding-bottom:5px;padding-left:10px;border:none}
|
15 |
-
</style>
|
16 |
-
</head>
|
17 |
-
<body>
|
18 |
-
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
19 |
-
<div class="labnol">
|
20 |
-
<xsl:variable name="u"> <xsl:value-of select="sitemap:loc"/> </xsl:variable>
|
21 |
-
<h1><a href="{$u}"><xsl:value-of select="video:video/video:title"/></a> </h1>
|
22 |
-
<xsl:variable name="t"> <xsl:value-of select="video:video/video:thumbnail_loc"/> </xsl:variable>
|
23 |
-
<a href="{$u}"><img src="{$t}" width="120" height="80" /></a>
|
24 |
-
<p>
|
25 |
-
<xsl:variable name="d"><xsl:value-of select="video:video/video:description"/> </xsl:variable>
|
26 |
-
<xsl:choose>
|
27 |
-
<xsl:when test="string-length($d) < 100">
|
28 |
-
<xsl:value-of select="$d"/>
|
29 |
-
</xsl:when>
|
30 |
-
<xsl:otherwise>
|
31 |
-
<xsl:value-of select="concat(substring($d,1,100),' ...')"/>
|
32 |
-
</xsl:otherwise>
|
33 |
-
</xsl:choose>
|
34 |
-
</p>
|
35 |
-
</div>
|
36 |
-
</xsl:for-each>
|
37 |
-
</body>
|
38 |
-
</html>
|
39 |
-
</xsl:template>
|
40 |
-
</xsl:stylesheet>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<xsl:stylesheet version="2.0"
|
3 |
+
xmlns:html="http://www.w3.org/TR/REC-html40"
|
4 |
+
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
5 |
+
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
|
6 |
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
7 |
+
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
8 |
+
<xsl:template match="/">
|
9 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
10 |
+
<head>
|
11 |
+
<title>XML Video Sitemap</title>
|
12 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
13 |
+
<style type="text/css">
|
14 |
+
body{font-family:Arial,sans-serif;font-size:11px;margin:0;padding:0}.labnol{margin:10px;float:left;border-top-width:1px;border-right-width:2px;border-bottom-width:2px;border-left-width:1px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:#CCC;border-right-color:#CCC;border-bottom-color:#CCC;border-left-color:#CCC;width:350px;height:110px;overflow:hidden;padding-top:5px;padding-right:5px;padding-bottom:10px;padding-left:5px}.labnol h1{font-family:Georgia,"Times New Roman",Times,serif;font-size:1.2em;margin:0;padding:0 0 5px}.labnol h1 a{text-decoration:none;color:#333}.labnol p{color:#666;margin:0px;padding-top:10px}.labnol img{float:right;padding-top:0;padding-bottom:5px;padding-left:10px;border:none}
|
15 |
+
</style>
|
16 |
+
</head>
|
17 |
+
<body>
|
18 |
+
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
19 |
+
<div class="labnol">
|
20 |
+
<xsl:variable name="u"> <xsl:value-of select="sitemap:loc"/> </xsl:variable>
|
21 |
+
<h1><a href="{$u}"><xsl:value-of select="video:video/video:title"/></a> </h1>
|
22 |
+
<xsl:variable name="t"> <xsl:value-of select="video:video/video:thumbnail_loc"/> </xsl:variable>
|
23 |
+
<a href="{$u}"><img src="{$t}" width="120" height="80" /></a>
|
24 |
+
<p>
|
25 |
+
<xsl:variable name="d"><xsl:value-of select="video:video/video:description"/> </xsl:variable>
|
26 |
+
<xsl:choose>
|
27 |
+
<xsl:when test="string-length($d) < 100">
|
28 |
+
<xsl:value-of select="$d"/>
|
29 |
+
</xsl:when>
|
30 |
+
<xsl:otherwise>
|
31 |
+
<xsl:value-of select="concat(substring($d,1,100),' ...')"/>
|
32 |
+
</xsl:otherwise>
|
33 |
+
</xsl:choose>
|
34 |
+
</p>
|
35 |
+
</div>
|
36 |
+
</xsl:for-each>
|
37 |
+
</body>
|
38 |
+
</html>
|
39 |
+
</xsl:template>
|
40 |
+
</xsl:stylesheet>
|