XML Sitemap & Google News feeds - Version 3.4

Version Description

  • bugfix: use home instead of siteurl for blog url for sitemap reference in robots.txt
  • code streamline and cleanup
Download this release

Release Info

Developer RavanH
Plugin Icon 128x128 XML Sitemap & Google News feeds
Version 3.4
Comparing to
See all releases

Code changes from version 3.3 to 3.4

feed-xml.php → feed-sitemap.xml.php RENAMED
@@ -6,13 +6,12 @@
6
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'feed-xml.php' == basename($_SERVER['SCRIPT_FILENAME']))
7
die ('Please do not load this page directly. Thanks!');
8
9
-
10
// priority presets
11
$post_priority = 0.7;
12
- $minpost_priority = 0.3;
13
$maxpost_priority = 0.9;
14
- $page_priority = 0.6;
15
- $frontpage_priority = 1.0;
16
17
$lastpostmodified = get_lastpostmodified('GMT');
18
@@ -20,7 +19,7 @@ $lastpostmodified = get_lastpostmodified('GMT');
20
@header('Content-Type: text/xml; charset=' . get_option('blog_charset'));
21
22
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?>
23
- <?xml-stylesheet type="text/xsl" href="'.get_option('siteurl').'/?feed=sitemap.xsl"?>
24
<!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
25
<!-- generator="XML Sitemap Feed plugin for WordPress" -->
26
<!-- generator-url="http://4visions.nl/en/index.php?section=57" -->
6
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'feed-xml.php' == basename($_SERVER['SCRIPT_FILENAME']))
7
die ('Please do not load this page directly. Thanks!');
8
9
// priority presets
10
+ $frontpage_priority = 1.0;
11
$post_priority = 0.7;
12
+ $minpost_priority = 0.1;
13
$maxpost_priority = 0.9;
14
+ $page_priority = 0.5;
15
16
$lastpostmodified = get_lastpostmodified('GMT');
17
19
@header('Content-Type: text/xml; charset=' . get_option('blog_charset'));
20
21
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?>
22
+ <?xml-stylesheet type="text/xsl" href="'.get_option('home').'/sitemap.xsl?v='.XMLSFVERSION.'"?>
23
<!-- generated-on="'.date('Y-m-d\TH:i:s+00:00').'" -->
24
<!-- generator="XML Sitemap Feed plugin for WordPress" -->
25
<!-- generator-url="http://4visions.nl/en/index.php?section=57" -->
feed-xsl.php → feed-sitemap.xsl.php RENAMED
File without changes
readme.txt CHANGED
@@ -1,167 +1,199 @@
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, wordpressmu, wpmu
5
Requires at least: 2.5
6
- Tested up to: 2.8
7
- Stable tag: 3.3
8
9
Creates a feed that complies with the XML Sitemap protocol ready for indexing by Google, Yahoo, MSN, Ask.com and others.
10
11
== Description ==
12
13
- This plugin dynamically creates an XML feed that complies with the XML Sitemap protocol. There are no options to be set and the feed becomes instantly available after activation on yourblogurl.tld/sitemap.xml (or yourblogurl.tld/index.php?feed=sitemap.xml if you do not use a fancy permalink structure) ready for indexing by search engines like Google, Yahoo, MSN, Ask.com and others.
14
-
15
- An entry `Sitemap: http://yourblogurl.tld/sitemap.xml` is added to the (by WordPress dynamically created) robots.txt on yourblogurl.tld/robots.txt to tell search engines where to find your XML Sitemap. If you do not use fancy URL's in WordPress, you will have to create your own robots.txt file. See FAQ's.
16
-
17
- = Advantages =
18
-
19
- * The main advantage of this plugin over other XML Sitemap plugins is **simplicity**. No need to change file or folder permissions or move files. In fact, no options at all!
20
- * 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.
21
- * Automatic priority calculation based on post age and comment/trackback activity.
22
-
23
- = Limitations =
24
-
25
- * The feed contains the front page and all posts and pages but (still) excludes category, tag and other dynamic archive pages.
26
- * There is no way (yet) to manually set the priority of posts/pages in the sitemap but by resaving older posts from time to time, keeping the lastmod date fairly recent, you can ensure high priority for those urls.
27
- * The number of posts listed in the sitemap is limited to 1000. This should satisfy most blogs while limiting the sitemap size on bigger blogs by stripping of the oldest posts. Please let me know if you need more than your most recent 1000 posts listed in your sitemap.xml :)
28
-
29
- = Translations =
30
-
31
- There is nothing to translate. The sitemap protocol is international, there is no options page nor any front-end output. Nothing to see here, please move along ;)
32
-
33
- = Credits =
34
- XML Sitemap Feed is based on the plugin Standard XML Sitemap Generator (discontinued?) by Patrick Chia. Many thanks!
35
-
36
37
== Installation ==
38
39
- = Wordpress =
40
41
- Just use that slick installation and auto update feature on your Pugins page
42
-
43
- &hellip; OR &hellip;
44
-
45
follow these simple steps:
46
47
1. Download archive.
48
49
- 2. Upload the zip file via the Plugins > Add New > Upload page &hellip; OR &hellip; unpack and upload with your favourite FTP client to the /plugins/ folder.
50
51
- 3. Activate the plugin on the Plug-ins page.
52
-
53
Done! Check your sparkling new XML Sitemap by visiting yourblogurl.tld/sitemap.xml (adapted to your domain name ofcourse) with a browser or any online XML Sitemap validator. You might also want to check if the sitemap is listed in your yourblogurl.tld/robots.txt file.
54
55
= Wordpress MU =
56
-
57
- The plugin also works from the /mu-plugins/ folder where it runs quietly in the background without bothering any blog owner with new options or the need for special knowledge of XML Sitemap submission. Just upload the complete package content to /mu-plugins/ and move the file xml-sitemap.php from the new /mu-plugins/xml-sitemap-feed/ to /mu-plugins/.
58
-
59
- Installed in /mu-plugins/ alongside [WordPress MU Sitewide Tags Pages](http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/), XML Sitemap Feed will not create a sitemap.xml nor change robots.txt for any tag blogs. They would be full of links outside the tags blogs own domain and subsequently ignored (or worse: penalized) by Google anyway.
60
-
61
- == Frequently Asked Questions ==
62
-
63
- = My WordPress powered blog is installed in a subdirectory. Does that change anything? =
64
-
65
- That depends on where the index.php of your installation resides. If it is in the root, meaning WP is installed in a subdir but the blog is accessible from your domain root, you do not have to do anything. It should work out of the box. However, if the index.php is (e.g. still with your wp-config.php and all other WP files) in a subdir, meaning your blog is only accessible via that subdir, you need to manage your own robots.txt file in your domain root. It _has_ to be in the root (!) and needs a line starting with `Sitemap:` followed by the full URL to the sitemap feed provided by XML Sitemap Feed plugin. Like:
66
- `
67
- Sitemap: http://yourblogurl.tld/subdir/sitemap.xml
68
- `
69
-
70
- = Can I manipulate values for priority and changefreq? =
71
-
72
- Yes and No. Since this plugin has no options page there is no way (yet) to manually set the priority of urls in the sitemap. Since version 2.0 there is some basic automatic priority calculation (based on post age and comment activity) doing the work for you.
73
-
74
- This feature can be used to your advantage: by resaving older posts from time to time, keeping the lastmod date fairly recent, you can ensure a priority of 70% (0.7) for those urls. And if you have comments on on those pages, the priority can even go up to 90% (0.9).
75
-
76
If you cannot live with these rules, edit the values `$post_priority`, `$minpost_priority`, `$maxpost_priority`, `$page_priority`, `$frontpage_priority` in xml-sitemap-feed/template-xml.php
77
78
- = How are the values for priority and changefreq calculated? =
79
-
80
- The front page has a fixed priority of 100% (1.0), pages are always 60% (0.6) and posts have a default priority of 70% (0.7) but can vary between 30% (0.3) and 90% (0.9) depending on comments and post age. the cangefreq of the frontpage is set to daily, monthly for pages and either monthly or weekly for posts depending on comments.
81
-
82
- Dynamic pages like category pages, tag pages and archive pages are not listed in this version yet.
83
-
84
- = Do I need to submit the sitemap to search engines? =
85
-
86
- No. In normal circumstances, your site will be indexed by the major search engines before you know it. The search engines will be looking for a robots.txt file and (with this plugin activated) find a pointer in it to the XML Sitemap on your blog. The search engines will return on a regular basis to see if your site has updates.
87
-
88
- = Does this plugin ping search engines? =
89
-
90
- No. While other XML Sitemap plugins provide pinging to some search engines upon each post edit or publication, this plugin does not. For the average website, in my experience, pinging Google or others after each little change does not benefit anything except a theoretical smaller delay in re-indexation of your website. This is only theoretical because if your site is popular and active, major search engines will likely be crawling your site on a very regular basis anyway. And if, on the other hand, your site is not high in the agenda with the major search engines, they will likely give no priority to your pings at all.
91
-
92
- Besides, WordPress has a built-in pinging feature. Go in your WP Admin section to Settings > Writing and make sure that the field under **Update services** contains at least
93
- `
94
- http://rpc.pingomatic.com
95
- `
96
- Read more on [Ping-O-Matic](http://pingomatic.com) about what excellent service you are actually getting for free with your WordPress installation!
97
-
98
- You can also take a [Google Webmaster Tools account](https://www.google.com/webmasters/tools/) which will tell you many interesting things about your website and your readers. Try it!
99
-
100
- = Do I need to make use of a fancy Permalink structure? =
101
-
102
- No. While I would advise you to use any one of the nicer Permalink structures, you might not be able to (or don't want to) do that. If so, you can still use this plugin:
103
-
104
- Check to see if the URL yourblogurl.tld/?feed=sitemap.xml (notice the **?feed=**!) does produce a feed. Now manually upload your own robots.txt file to your website root containing:
105
- `
106
- Sitemap: http://yourblogurl.tld/?feed=sitemap.xml
107
-
108
- User-agent: *
109
- Disallow:
110
`
111
- You can also choose to notify major search engines of your new XML sitemap manually. Start with getting a [Google Webmaster Tools account](https://www.google.com/webmasters/tools/).
112
-
113
- = Can I change the sitemap name/URL? =
114
115
- No. If you have fancy URL's turned ON in WordPress (Permalinks), the sitemap url that you manually submit to Google (if you are impatient) should be `yourblogurl.tld/sitemap.xml` but if you have the Default option set the feed is only available via `yourblogurl.tld/?feed=sitemap.xml` (notice the *?feed=*).
116
117
- = I see no sitemap.xml file in my server space! =
118
119
- The sitemap is dynamically generated just like a feed. There is no actual file created.
120
121
- = Where can I customize the xml output? =
122
123
- You may edit the XML output in `xml-sitemap-feed/feed-xml.php` but be carefull not to break Sitemap protocol comliance. Read more on [Sitemaps XML format](http://www.sitemaps.org/protocol.php).
124
-
125
The stylesheet (to make the sitemap human readable) can be edited in `xml-sitemap-feed/feed-xsl.php`.
126
127
- = Do I need to change my robots.txt? =
128
-
129
- No. Your sitemap url will be automatically added to your dynamic robots.txt when plugin actived. Unless you use a static robots.txt file in your website root. In that case you are advised to open it in a text editor and add a line like `Sitemap: http://yourblogurl.tld/sitemap.xml` (adapt to your site url).
130
-
131
- = I get a 404 page instead of sitemap.xml and robots.txt! =
132
-
133
- There are plugins like Event Calendar (at least v.3.2.beta2) known to mess with rewrite rules, causing problems with WordPress internal feeds and robots.txt generation and thus conflict with the XML Sitemap Feed plugin. Deactivate all plugins and see if you get a basic robots.txt file showing:
134
- `
135
- User-agent: *
136
- Disallow:
137
- `
138
- Reactivate your plugins one by one to find out which one is causing the problem. Then report the bug to the plugin developer.
139
-
140
- == Changelog ==
141
-
142
- = 3.3 =
143
- * automatic exclusion of tags blog in wpmu
144
-
145
- = 3.2 =
146
- * rewrite and add_feed calls improvements
147
- * bugfix: double entry when static page is frontpage
148
-
149
- = 3.0 =
150
- * added styling to the xml feed to make it human readable
151
-
152
- = 2.1 =
153
- * bugfix: lastmod timezone offset displayed wrong (extra space and missing double-colon)
154
-
155
- = 2.0 =
156
- * priority calculation based on comments and age
157
- * changefreq based on comments
158
-
159
- = 1.0 =
160
- * changed feed template location to avoid the need to relocate files outside the plugins folder
161
- * bugfix: `get_post_modified_time` instead of `get_post_time`
162
- * bugfix: rewrite rules causing unlimited amount of sitemap feeds on any url ending with sitemap.xml instead of just one in the root
163
-
164
- = 0.1 =
165
- * rework from Patrick Chia's [Standard XML Sitemaps](http://wordpress.org/extend/plugins/standard-xml-sitemap/)
166
- * increased post urls limit from 100 to 1000 (of max. 50,000 allowed by the Sitemap protocol)
167
-
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: sitemap, xml sitemap, google, yahoo, feed, wpmu
5
Requires at least: 2.5
6
+ Tested up to: 3.0
7
+ Stable tag: 3.4
8
9
Creates a feed that complies with the XML Sitemap protocol ready for indexing by Google, Yahoo, MSN, Ask.com and others.
10
11
== Description ==
12
13
+ This plugin dynamically creates an XML feed that complies with the XML Sitemap protocol. There are no options to be set and the feed becomes instantly available after activation on yourblogurl.tld/sitemap.xml (or yourblogurl.tld/index.php?feed=sitemap.xml if you do not use a fancy permalink structure) ready for indexing by search engines like Google, Yahoo, MSN, Ask.com and others.
14
+
15
+ An entry `Sitemap: http://yourblogurl.tld/sitemap.xml` is added to the (by WordPress dynamically created) robots.txt on yourblogurl.tld/robots.txt to tell search engines where to find your XML Sitemap. If you do not use fancy URL's in WordPress, you will have to create your own robots.txt file. See FAQ's.
16
+
17
+ = Advantages =
18
+
19
+ * The main advantage of this plugin over other XML Sitemap plugins is **simplicity**. No need to change file or folder permissions, move files or spend time on a difficult plugin options page. In fact, there are no options at all!
20
+ * Works out-of-the-box on **multi-site / shared codebase / multi-blog setups** like [WordPress MU](http://mu.wordpress.org/), WP 3.0 in MS mode and others.
21
+ * Automatic post URL priority calculation based on post age and comment/trackback activity.
22
+ * Works both when **Network Activated** or placed in **/mu-plugins/** on WP 3.0 in Mutli site mode and WPMU.
23
+
24
+ = Limitations =
25
+
26
+ * The feed contains the front page and all posts and pages but _excludes_ category, tag and other dynamic archive pages. This should not be a problem and by some it is even advised. There are SEO plugins around that even make these archive pages non-indexable by search engines.
27
+ * Except by _resaving_ older posts from time to time (keeping the lastmod date fairly recent to ensure automatic high priority calculation for those urls) there is no way to manually set the priority of individual posts/pages in the sitemap. See the Faq's for more.
28
+ * This plugin does not ping any search engines. But then, WordPress does this by default already via the Ping-o-Matic service so why bother?
29
+ * The number of posts listed in the sitemap is limited to 1000. This should satisfy most blogs while limiting the sitemap size on bigger blogs by stripping of the oldest posts. Please let me know if you need more than your most recent 1000 posts listed in your sitemap.xml :)
30
+
31
+ = Translations =
32
+
33
+ There is nothing to translate. The sitemap protocol is international, there is no options page nor any front-end / widget output. Nothing to see here, please move along ;)
34
+
35
+ = Credits =
36
+ XML Sitemap Feed was originally based on the (discontinued?) plugin Standard XML Sitemap Generator by Patrick Chia. Many thanks!
37
+
38
39
== Installation ==
40
41
+ = Wordpress =
42
+
43
+ Just use that slick installation and auto update feature on your Pugins page
44
+
45
+ &hellip; OR &hellip;
46
47
follow these simple steps:
48
49
1. Download archive.
50
51
+ 2. Upload the zip file via the Plugins > Add New > Upload page &hellip; OR &hellip; unpack and upload with your favourite FTP client to the /plugins/ folder.
52
+
53
+ 3. Activate the plugin on the Plug-ins page.
54
55
Done! Check your sparkling new XML Sitemap by visiting yourblogurl.tld/sitemap.xml (adapted to your domain name ofcourse) with a browser or any online XML Sitemap validator. You might also want to check if the sitemap is listed in your yourblogurl.tld/robots.txt file.
56
57
= Wordpress MU =
58
+
59
+ The plugin works best from the **/mu-plugins/** folder where it runs quietly in the background without bothering any blog owner with new options or the need for special knowledge of XML Sitemap submission. Just upload the complete package content to /mu-plugins/ and move the file xml-sitemap.php from the new /mu-plugins/xml-sitemap-feed/ to /mu-plugins/.
60
+
61
+ Installed in /mu-plugins/ alongside [WordPress MU Sitewide Tags Pages](http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/), XML Sitemap Feed will **not** create a sitemap.xml nor change robots.txt for any tag blogs. They would be full of links outside the tags blogs own domain and subsequently ignored (or worse: penalized) by Google.
62
+
63
+ == Frequently Asked Questions ==
64
+
65
+ Questions devided in **Sitemap / Robots** with most q&a about sitemap.xml and robots.txt, **WordPress** with q&a about your WordPress configuration and **Advanced / Troubleshooting** with more advanced q&a and troubleshooting issues.
66
+
67
+ = Sitemap / Robots =
68
+
69
+ **Q: How are the values for priority and changefreq calculated?**
70
+
71
+ **A:** The front page has a fixed priority of 100% (1.0), pages are always 50% (0.5) and new posts have a default priority of 70% (0.7) but can vary between 10% (0.1) and 90% (0.9) depending on comments and post age. The cangefreq of the frontpage is set to daily, monthly for pages and either monthly or weekly for posts depending on comments.
72
+
73
+ Dynamic pages like category pages, tag pages and archive pages are not listed in the XML Sitemap.
74
+
75
+ **Q: Can I manipulate values for priority and changefreq?**
76
+
77
+ **A:** Yes and No. Since this plugin has no options page there is no way (yet) to manually set the priority of urls in the sitemap. The priority of the frontpage is fixed to 100% (1.0), all other pages are fixed to 50% (0.5) and new posts are always 70% (0.7). Since version 2.0 there is automatic post priority calculation based on post age and comment activity, that can either make post priority go to 90% (0.9) for fairly recent posts with many comments or 10% (0.1) for very old posts with no comments.
78
+
79
+ This feature can be used to your advantage: by resaving your most important older posts from time to time, keeping the lastmod date fairly recent, you can ensure a priority of at least 70% (0.7) for those urls. And if you have comments on on those pages, the priority will even go up to 90% (0.9).
80
+
81
If you cannot live with these rules, edit the values `$post_priority`, `$minpost_priority`, `$maxpost_priority`, `$page_priority`, `$frontpage_priority` in xml-sitemap-feed/template-xml.php
82
83
+ **Q: Do I need to submit the sitemap to search engines?**
84
+
85
+ **A:** No. In normal circumstances, your site will be indexed by the major search engines before you know it. The search engines will be looking for a robots.txt file and (with this plugin activated) find a pointer in it to the XML Sitemap on your blog. The search engines will return on a regular basis to see if your site has updates.
86
+
87
+ Read more about _Ping-O-Matic_ under **Does this plugin ping search engines** (below) to make sure your site is under _normal circumstances_ ;)
88
+
89
+ **Q: Does this plugin ping search engines?**
90
+
91
+ **A:** No. While other XML Sitemap plugins provide pinging to some search engines upon each post edit or publication, this plugin does not. There are two reasons for that:
92
+
93
+ 1. WordPress has a built-in pinging feature. Go in your WP Admin section to Settings > Writing and make sure that the text area under **Update services** contains at least
94
+ `
95
+ http://rpc.pingomatic.com
96
+ `
97
+ Read more on [Ping-O-Matic](http://pingomatic.com) about what excellent service you are actually getting _for free with every WordPress blog_ installation!
98
+
99
+ 2. For the average website, in my experience, pinging Google or others after each little change does not benefit anything except a theoretical smaller delay in re-indexation of your website. This is only theoretical because if your site is popular and active, major search engines will likely be crawling your site on a very regular basis anyway. And if, on the other hand, your site is not high on the agenda of the major search engines, they will likely give no priority to your pings at all.
100
+
101
+ You can always take a [Google Webmaster Tools account](https://www.google.com/webmasters/tools/) which will tell you many interesting things about your website, search terms and your visitors. Try it!
102
+
103
+ **Q: I see no sitemap.xml file in my server space!**
104
+
105
+ **A:** The sitemap is dynamically generated just like a feed. There is no actual file created.
106
+
107
+ **Q: Do I need to change my robots.txt?**
108
+
109
+ **A:** That depends. If you have no physical robots.txt file in your site root, the new sitemap url will be automatically added to your dynamic robots.txt when plugin actived. But if you use a static robots.txt file in your website root, you will need to open it in a text editor and add a line like `Sitemap: http://yourblogurl.tld/sitemap.xml` (adapt to your site url) to make search engines find your XML Sitemap.
110
+
111
+ = WordPress =
112
+
113
+ **Q: My WordPress powered blog is installed in a subdirectory. Does that change anything?**
114
+
115
+ **A:** That depends on where the index.php and .htaccess of your installation resides. If it is in the root, meaning WP is installed in a subdir but the blog is accessible from your domain root, you do not have to do anything. It should work out of the box. However, if the index.php is (e.g. still with your wp-config.php and all other WP files) in a subdir, meaning your blog is only accessible via that subdir, you need to manage your own robots.txt file in your domain root. It _has_ to be in the root (!) and needs a line starting with `Sitemap:` followed by the full URL to the sitemap feed provided by XML Sitemap Feed plugin. Like:
116
`
117
+ Sitemap: http://yourblogurl.tld/subdir/sitemap.xml
118
+ `
119
+
120
+ If you already have a robots.txt file with a line like that, you might want to read more about creating an XML Sitemap Index on [sitemaps.org](http://www.sitemaps.org/protocol.php#index).
121
122
+ **Q: Do I need to use a fancy Permalink structure?**
123
124
+ **A:** No. While I would advise you to use any one of the nicer Permalink structures, you might not be able to (or don't want to) do that. If so, you can still use this plugin:
125
126
+ Check to see if the URL yourblogurl.tld/?feed=sitemap.xml (notice the **?feed=**!) does produce a feed. Now manually upload your own robots.txt file to your website root containing:
127
+ `
128
+ Sitemap: http://yourblogurl.tld/?feed=sitemap.xml
129
130
+ User-agent: *
131
+ Allow: /
132
+ `
133
+ You can also choose to notify major search engines of your new XML sitemap manually. Start with getting a [Google Webmaster Tools account](https://www.google.com/webmasters/tools/).
134
+
135
+ = Advanced / Troubleshooting =
136
+
137
+ **Q: Can I change the sitemap name/URL?**
138
+
139
+ **A:** No. If you have fancy URL's turned ON in WordPress (Permalinks), the sitemap url that you manually submit to Google (if you are impatient) should be `yourblogurl.tld/sitemap.xml` but if you have the Default option set the feed is only available via `yourblogurl.tld/?feed=sitemap.xml` (notice the *?feed=*).
140
+
141
+ **Q: Where can I customize the xml output?**
142
+
143
+ **A:** You may edit the XML output in `xml-sitemap-feed/feed-xml.php` but be carefull not to break Sitemap protocol comliance. Read more on [Sitemaps XML format](http://www.sitemaps.org/protocol.php).
144
145
The stylesheet (to make the sitemap human readable) can be edited in `xml-sitemap-feed/feed-xsl.php`.
146
147
+ **Q: I get a 404 page instead of both sitemap.xml and robots.txt!**
148
+
149
+ **A:** There are plugins like Event Calendar (at least v.3.2.beta2) known to mess with rewrite rules, causing problems with WordPress internal feeds and robots.txt generation and thus conflict with the XML Sitemap Feed plugin. Deactivate all plugins and see if you get a basic robots.txt file showing:
150
+ `
151
+ User-agent: *
152
+ Disallow:
153
+ `
154
+ Reactivate your plugins one by one to find out which one is causing the problem. Then report the bug to the plugin developer.
155
+
156
+ **Q: I get a 404 page instead of robots.txt while sitemap.xml works fine!**
157
+
158
+ **A:** There is a know issue with WordPress (at least up to 2.8) not generating a robots.txt when there are _no posts_ with _published_ status. If you use WordPress as a CMS with only _pages_, this will affect you.
159
+
160
+ To get around this, you might either at least write one post and give it _Private_ status or alternatively create your own robots.txt file containing:
161
+ `
162
+ Sitemap: http://yourblogurl.tld/sitemap.xml
163
+
164
+ User-agent: *
165
+ Allow: /
166
+ `
167
+ and upload it to your web root...
168
+
169
+ == Changelog ==
170
+
171
+ = 3.4 =
172
+ * bugfix: use home instead of siteurl for blog url for sitemap reference in robots.txt
173
+ * code streamline and cleanup
174
+
175
+ = 3.3 =
176
+ * automatic exclusion of tags blog in wpmu
177
+
178
+ = 3.2 =
179
+ * rewrite and add_feed calls improvements
180
+ * bugfix: double entry when static page is frontpage
181
+
182
+ = 3.0 =
183
+ * added styling to the xml feed to make it human readable
184
+
185
+ = 2.1 =
186
+ * bugfix: lastmod timezone offset displayed wrong (extra space and missing double-colon)
187
+
188
+ = 2.0 =
189
+ * priority calculation based on comments and age
190
+ * changefreq based on comments
191
+
192
+ = 1.0 =
193
+ * changed feed template location to avoid the need to relocate files outside the plugins folder
194
+ * bugfix: `get_post_modified_time` instead of `get_post_time`
195
+
196
+ = 0.1 =
197
+ * rework from Patrick Chia's [Standard XML Sitemaps](http://wordpress.org/extend/plugins/standard-xml-sitemap/)
198
+ * increased post urls limit from 100 to 1000 (of max. 50,000 allowed by the Sitemap protocol)
199
+
xml-sitemap.php CHANGED
@@ -3,7 +3,7 @@
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 with the XML Sitemap protocol to aid Google, Yahoo, MSN, Ask.com indexing your blog. Based on the Standard XML Sitemap Generator by Patrick Chia.
6
- Version: 3.3
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
@@ -31,7 +31,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravan
31
-------------------- */
32
33
// set version
34
- define('XMLSFVERSION','3.3');
35
36
// dir
37
$xmlsf_dir = dirname(__FILE__);
@@ -47,21 +47,22 @@ if (file_exists($xmlsf_dir.'/xml-sitemap-feed'))
47
// FEEDS //
48
// set the XML feeds up
49
function xml_sitemap_add_feeds() {
50
- global $wp_rewrite;
51
- add_feed('sitemap.xml','xml_sitemap_do_feed');
52
- add_feed('sitemap.xsl','xml_sitemap_xsl_do_feed');
53
- add_action('generate_rewrite_rules', 'xml_sitemap_feed_rewrite');
54
- $wp_rewrite->flush_rules();
55
}
56
// load XML template
57
- function xml_sitemap_do_feed() {
58
- global $xmlsf_dir;
59
- load_template( $xmlsf_dir . '/feed-xml.php' );
60
}
61
// load XSL (style) template
62
- function xml_sitemap_xsl_do_feed() {
63
- global $xmlsf_dir;
64
- load_template( $xmlsf_dir . '/feed-xsl.php' );
65
}
66
// add the rewrite rules
67
function xml_sitemap_feed_rewrite($wp_rewrite) {
@@ -71,11 +72,16 @@ function xml_sitemap_feed_rewrite($wp_rewrite) {
71
);
72
$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
73
}
74
75
// ROBOTSTXT //
76
// get sitemap location in robots.txt generated by WP
77
function xml_sitemap_robots() {
78
- echo "\nSitemap: ".get_option('siteurl')."/sitemap.xml\n\n";
79
}
80
81
/* --------------------
@@ -91,7 +97,13 @@ if ( $wpdb->blogid && function_exists('get_site_option') && get_site_option('tag
91
// FEEDS
92
add_action('init', 'xml_sitemap_add_feeds');
93
94
// ROBOTSTXT
95
add_action('do_robotstxt', 'xml_sitemap_robots');
96
}
97
?>
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 with the XML Sitemap protocol to aid Google, Yahoo, MSN, Ask.com indexing your blog. Based on the Standard XML Sitemap Generator by Patrick Chia.
6
+ Version: 3.4
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
31
-------------------- */
32
33
// set version
34
+ define('XMLSFVERSION','3.4');
35
36
// dir
37
$xmlsf_dir = dirname(__FILE__);
47
// FEEDS //
48
// set the XML feeds up
49
function xml_sitemap_add_feeds() {
50
+ add_feed('sitemap.xml','do_feed_sitemapxml');
51
+ add_feed('sitemap.xsl','do_feed_sitemapxsl');
52
}
53
// load XML template
54
+ if ( !function_exists(do_feed_sitemapxml) ) {
55
+ function do_feed_sitemapxml() {
56
+ global $xmlsf_dir;
57
+ load_template( $xmlsf_dir . '/feed-sitemap.xml.php' );
58
+ }
59
}
60
// load XSL (style) template
61
+ if ( !function_exists(do_feed_sitemapxsl) ) {
62
+ function do_feed_sitemapxsl() {
63
+ global $xmlsf_dir;
64
+ load_template( $xmlsf_dir . '/feed-sitemap.xsl.php' );
65
+ }
66
}
67
// add the rewrite rules
68
function xml_sitemap_feed_rewrite($wp_rewrite) {
72
);
73
$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
74
}
75
+ // recreate rewrite rules (only needed upon plugin activation)
76
+ function xml_sitemap_activate() {
77
+ global $wp_rewrite;
78
+ $wp_rewrite->flush_rules();
79
+ }
80
81
// ROBOTSTXT //
82
// get sitemap location in robots.txt generated by WP
83
function xml_sitemap_robots() {
84
+ echo "Sitemap: ".get_option('home')."/sitemap.xml\n\n";
85
}
86
87
/* --------------------
97
// FEEDS
98
add_action('init', 'xml_sitemap_add_feeds');
99
100
+ // REWRITES
101
+ add_filter('generate_rewrite_rules', 'xml_sitemap_feed_rewrite');
102
+
103
// ROBOTSTXT
104
add_action('do_robotstxt', 'xml_sitemap_robots');
105
}
106
+
107
+ // ACTIVATION
108
+ register_activation_hook( __FILE__, 'xml_sitemap_activate' );
109
?>