Version Description
- changed feed template location to avoid the need to relocate files outside the plugins folder
- bugfix: get_post_modified_time instead of get_post_time
- bugfix: rewrite rules causing unlimited amount of sitemap feeds on any url ending with sitemap.xml instead of just one in the root
Download this release
Release Info
Developer | RavanH |
Plugin | XML Sitemap & Google News feeds |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- readme.txt +69 -0
- template.php +47 -0
- xml-sitemap.php +57 -0
readme.txt
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== XML Sitemap Feed ===
|
2 |
+
Contributors: RavanH
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap&item_number=2%2e6%2e2%2e9&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
+
Tags: xml sitemap, sitemap, google sitemap, yahoo sitemap, msn sitemap, ask sitemap, search engine, feed
|
5 |
+
Requires at least: 2.5
|
6 |
+
Tested up to: 2.8
|
7 |
+
Stable tag: 1.0
|
8 |
+
|
9 |
+
Creates a feed that complies to the XML Sitemap protocol ready be submitted to Google, Yahoo, MSN, Ask.com and others.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This plugin dynamicaly creates an XML feed that complies to the XML Sitemap protocol. The main advantages of this approach are simplicity (no need to change file or folder permissions or move files) and the fact that this method works out-of-the-box on shared codebase / multi-blog setups like [WordPress MU](http://mu.wordpress.org/), [WP_OneInstall](http://wordpress.org/extend/plugins/wp-oneinstall/), [WP Hive](http://wordpress.org/extend/plugins/wp-hive/) and others.
|
14 |
+
|
15 |
+
It requires no options to be set and instantly creates the feed of all posts on http://yourblogurl.tld/sitemap.xml and http://yourblogurl.tld/feed/sitemap. Ready to be submitted to search engines like Google, Yahoo, MSN, Ask.com and others. An entry `Sitemap: http://yourblogurl.tld/sitemap.xml` is added to the (by WordPress dynamicly created) robots.txt on http://yourblogurl.tld/robots.txt that will tell search engines visiting your blog where to find the XML Sitemap.
|
16 |
+
|
17 |
+
It was based on the plugin Standard XML Sitemap Generator by Patrick Chia but requires no modifications to file locations. Some small improvements and a bugfix were done in the first version.
|
18 |
+
|
19 |
+
Current version limits:
|
20 |
+
* The feed contains the front page and all posts (normal pages are treated as posts) but excludes category, tag and other dynamic archive pages.
|
21 |
+
* The number of posts listed in the sitemap is limited to 1000. Please let me know if you need more than that :)
|
22 |
+
|
23 |
+
== Installation ==
|
24 |
+
|
25 |
+
= Wordpress =
|
26 |
+
|
27 |
+
Just use that slick installation and auto update feature on your Pugins page - OR - follow these simple steps:
|
28 |
+
|
29 |
+
1. Download archive and unpack.
|
30 |
+
|
31 |
+
2. Upload the unpacked folder and its content to the /plugins/ folder.
|
32 |
+
|
33 |
+
3. Activate the plugin on the Plug-ins page.
|
34 |
+
|
35 |
+
Done! Check your sparkling new XML Sitemap by adapting the url http://yourblogurl.tld/sitemap.xml to your blog and visiting it with a browser or online XML Sitemap validator. You might also want to see if the sitemap is listed in your http://yourblogurl.tld/robots.txt file.
|
36 |
+
|
37 |
+
= Wordpress MU =
|
38 |
+
|
39 |
+
The plugin also works from the /mu-plugins/ folder where it works quietly in the background without bothering any blog owner with new options or the need for extra knowledge of XML Sitemap submission. Just upload the cpmplete package content and move the file xml-sitemap.php from /mu-plugins/xml-sitemap-feed/ to /mu-plugins/.
|
40 |
+
|
41 |
+
== Frequently Asked Questions ==
|
42 |
+
|
43 |
+
= Can I change the sitemap name/URL? =
|
44 |
+
|
45 |
+
No. The sitemap url that you manually submit too Google (if you are impatient) should be http://yourblogurl.tld/sitemap.xml but is also available via http://yourblogurl.tld/feed/sitemap
|
46 |
+
|
47 |
+
= I found no sitemap file in my blog! =
|
48 |
+
|
49 |
+
The sitemap is dynamically generated just like a feed. There is no actual file created.
|
50 |
+
|
51 |
+
= Where can I customize the xml output? =
|
52 |
+
|
53 |
+
You may edit the XML output in template.php but be carefull not to break Sitemap protocol comliance. Read more on [Sitemaps XML format](http://www.sitemaps.org/protocol.php).
|
54 |
+
|
55 |
+
= Do I need change my robots.txt? =
|
56 |
+
|
57 |
+
No. Your sitemap url will be automatically added to your dynamic robots.txt when plugin actived. Unless you have a static file robots.txt in your root. In that case you might want to open it in a text editor and add a line like `Sitemap: http://yourblogurl.tld/sitemap.xml` to it.
|
58 |
+
|
59 |
+
== Changelog ==
|
60 |
+
|
61 |
+
= 1.0 =
|
62 |
+
* changed feed template location to avoid the need to relocate files outside the plugins folder
|
63 |
+
* bugfix: get_post_modified_time instead of get_post_time
|
64 |
+
* bugfix: rewrite rules causing unlimited amount of sitemap feeds on any url ending with sitemap.xml instead of just one in the root
|
65 |
+
|
66 |
+
= 0.1 =
|
67 |
+
* rework from Patrick Chia's [Standard XML Sitemaps](http://wordpress.org/extend/plugins/standard-xml-sitemap/)
|
68 |
+
* increased post urls limit from 100 to 1000 (of max. 50,000 allowed by the Sitemap protocol)
|
69 |
+
|
template.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* XML Sitemap Feed Template 1.0
|
4 |
+
**/
|
5 |
+
|
6 |
+
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'feed-sitemap.php' == basename($_SERVER['SCRIPT_FILENAME']))
|
7 |
+
die ('Please do not load this page directly. Thanks!');
|
8 |
+
|
9 |
+
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
|
10 |
+
$more = 1;
|
11 |
+
|
12 |
+
?>
|
13 |
+
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
|
14 |
+
<!-- generator="XML Sitemap WordPress plugin/1.0" -->
|
15 |
+
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
16 |
+
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
|
17 |
+
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
18 |
+
<url>
|
19 |
+
<loc><?php bloginfo_rss('url') ?></loc>
|
20 |
+
<lastmod><?php echo mysql2date('Y-m-d\TH:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastmod>
|
21 |
+
<changefreq>daily</changefreq>
|
22 |
+
<priority>1.0</priority>
|
23 |
+
</url>
|
24 |
+
<?php
|
25 |
+
|
26 |
+
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1000");
|
27 |
+
|
28 |
+
if ($post_ids) {
|
29 |
+
global $wp_query;
|
30 |
+
$wp_query->in_the_loop = true;
|
31 |
+
|
32 |
+
while ( $next_posts = array_splice($post_ids, 0, 20) ) {
|
33 |
+
$where = "WHERE ID IN (".join(',', $next_posts).")";
|
34 |
+
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt DESC");
|
35 |
+
foreach ($posts as $post) {
|
36 |
+
setup_postdata($post);
|
37 |
+
?>
|
38 |
+
<url>
|
39 |
+
<loc><?php the_permalink_rss() ?></loc>
|
40 |
+
<lastmod><?php echo mysql2date('Y-m-d\TH:i:s +0000', get_post_modified_time('Y-m-d H:i:s', true), false); ?></lastmod>
|
41 |
+
<changefreq>monthly</changefreq>
|
42 |
+
<priority>0.6</priority>
|
43 |
+
</url>
|
44 |
+
<?php }
|
45 |
+
}
|
46 |
+
} ?>
|
47 |
+
</urlset>
|
xml-sitemap.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: XML Sitemap Feed
|
4 |
+
Plugin URI: http://4visions.nl/en/index.php?section=57
|
5 |
+
Description: Creates a dynamic XML feed that complies to the XML Sitemap protocol ready be submitted to Google, Yahoo, MSN, Ask.com and others. Based on the Standard XML Sitemap Generator by Patrick Chia.
|
6 |
+
Version: 1.0
|
7 |
+
Author: RavanH
|
8 |
+
Author URI: http://4visions.nl/
|
9 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=XML%20Sitemap%20Feed&item_number=2%2e6%2e2%2e9&no_shipping=0&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8
|
10 |
+
*/
|
11 |
+
|
12 |
+
/* Copyright 2009 RavanH (http://4visions.nl/ email : ravanhagen@gmail.com)
|
13 |
+
|
14 |
+
This program is free software; you can redistribute it and/or modify
|
15 |
+
it under the terms of the GNU General Public License as published by
|
16 |
+
the Free Software Foundation; either version 2 of the License, or
|
17 |
+
(at your option) any later version.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program; if not, write to the Free Software
|
26 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
+
*/
|
28 |
+
|
29 |
+
function xml_sitemap_flush_rules() {
|
30 |
+
global $wp_rewrite;
|
31 |
+
$wp_rewrite->flush_rules();
|
32 |
+
}
|
33 |
+
add_action('init', 'xml_sitemap_flush_rules');
|
34 |
+
|
35 |
+
function xml_sitemap_feed_rewrite($wp_rewrite) {
|
36 |
+
$feed_rules = array(
|
37 |
+
'^sitemap.xml$' => 'index.php?feed=sitemap',
|
38 |
+
'^feed/sitemap$' => 'index.php?feed=sitemap'
|
39 |
+
);
|
40 |
+
$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
|
41 |
+
}
|
42 |
+
add_filter('generate_rewrite_rules', 'xml_sitemap_feed_rewrite');
|
43 |
+
|
44 |
+
function xml_sitemap_do_feed() {
|
45 |
+
$dir = dirname(__FILE__);
|
46 |
+
if (file_exists($dir.'/xml-sitemap-feed')) // chech if xml-sitemap.php was moved one dir up (for mu-plugins in wpmu)
|
47 |
+
load_template( $dir . '/xml-sitemap-feed/template.php' );
|
48 |
+
else
|
49 |
+
load_template( $dir . '/template.php' );
|
50 |
+
}
|
51 |
+
add_action('do_feed_sitemap', 'xml_sitemap_do_feed', 10, 1);
|
52 |
+
|
53 |
+
function xml_sitemap_robots() {
|
54 |
+
echo "\nSitemap: ".get_option('siteurl')."/sitemap.xml\n\n";
|
55 |
+
}
|
56 |
+
add_action('do_robotstxt', 'xml_sitemap_robots');
|
57 |
+
?>
|