Hi
I have been coding a bit on a Zenphoto plugin the last couple of days, it is a sitemap generator which can be used with the larger search engines (Google, Live Search, etc.) and it's compatible with the
sitemaps.org specifications.
It's really simple to install, just copy the file into the zp-core/plugins directory, activate the plugin through the administration interface and then point the search engines at [your Zenphoto folder]/?sitemap, and it will take care of the rest.
Link for download and (a little) more info is on
my homepage.
Note: I am aware that there is an existing Google sitemap generator already, which is mentioned on the
hacks page. But I haven't been able to access the site linked to recently, and now that I have seen the code it honestly isn't that pretty made.
By the way... Shouldn't there be a plugins section here on the forums, in order to keep them a bit separated from the Zenphoto core?
Comments
How can we get this into the mainstream distro?
One warning that I have in google is the following, FYI:
For ?sitemap=root
All the URLs in your Sitemap have the same priority.
All the URLs in your Sitemap are set to the same priority (not the default priority). Priority indicates the importance of a particular URL relative to other URLs on your site, and doesn't impact your site's performance in search results. If all URLs have the same priority, Google can't tell which are more important.
Regarding that error, I have had another report from another user experiencing the same warning message. I don't think it has any effect, but the warning could probably be avoided by removing/commenting out line 64 of the plugin (`echo "1.0\n";`).
I don't understand why I don't get the warning message though...
http://gallery.tenzer.dk/?sitemap=root http://gallery.tenzer.dk/?sitemap=7 http://gallery.tenzer.dk/?sitemap=3 http://gallery.tenzer.dk/?sitemap=4 http://gallery.tenzer.dk/?sitemap=6 http://gallery.tenzer.dk/?sitemap=5 http://gallery.tenzer.dk/?sitemap=8 http://gallery.tenzer.dk/?sitemap=9
Reg. priority: Only the top URL should be 1.0; album URLs can be 0.5; and all pictures should be 0.5 or 0.4;
In your program, there is a common code to set priority for all URLs. If it's set based on type of the page (front page, album, picture, etc), that would be nice.
Also, there is no frequency mentioned. SEs will love to see the frequency so that they know when to come back.
I haven't installed your plugin yet. I want to change the priority parm before installing it.
I have updated the plugin with two minor fixes. You can read the detailed information at my homepage: http://tenzer.dk/zenphoto-sitemap-101
jollywood, a sitemap was generated when you tried it out on my gallery, but your browser was simply interpreting the page as normal HTML, which means that it only showed the links. If you chose "View source" you would see the correct XML file.
One of the changes in the new version is that the correct XML content type header is sent out, which informs your browser that it is receiving an XML file.
The plugin doesn't specify any priorities any longer, since it didn't work out correctly before. In order for priorities to work correctly, all the URLs has to be in the same XML file, since the priorities are only compared with other URLs in the same XML file.
Since that would be a larger piece of work that would need to be put into that, I just skipped out the priority part for now. It may be the next thing to do for the plugin.
It's hard for me to specify the change frequency, as that purely depends on the activity in the gallery. Some logic to calculate how often new pictures are added, and how often new comments are posted would probably have to made then, which makes the plugin much larger than what I aimed it to be. I just wanted to have it as a file that is put into the Zenphoto plugin folder, and just works from there.
The other approach to this would be that the administrator of the gallery simply specified the change frequency for each type of page (root, gallery, picture), and then some kind of interface would have to be made for this in the administration interface, but that is probably easier than coding the above described logic into the plugin.
http://tenzer.dk/zenphoto-sitemap-102
This version does not really bring any new features, but instead gives performance improvements, and lowers the amount of database and HTTP queries needed from the search engines.
I do have a few ideas for new features, which can be found on the issue tracker for the plugins GitHub page: http://github.com/Tenzer/zenphoto-sitemap/issues
Let me know if you experience any issues with it, or if you have any feature requests!
I'd like to ask if it wouldn't be much trouble to provide an option to choose whether sitemap is to be created in gzipped form (sitemap.xml.gz) or not (sitemap.xml).
Thank you
I generally tried to make the plugin as easy to use as possible, by not requiring write permissions anywhere on the file system or any mod_rewrite rules and such, but I guess some checking could be made to see if a certain path is writable, and in that case generate a static sitemap. The difficult part would then be when to update the sitemap, but I'll have to look further into that.
Only thing missing is a admin overview button to clear the cache manually right now.
Btw, you/we could think about changing the plugin to use the object model framework later.
I would really like to keep the plugin in one file in order to keep it simple to use. Simply drop it into the correct folder, activate the plugin and it should work. Why would there be a need for two files?
The split into two files is necessary because somehow one internal function for this check does not work with the single file solution as it is not available and caused a fatal error.
Of course if you don't use album passwords/album user assignments you don't need that but we want to have a general plugin, don't we?
The usage is still very easy, drop the zenphoto-sitemap.php plugin into the `plugins` folder and then drop the sitemap.php file into the root. Done. Not really that complicated. If the plugin is disabled sitemap.php returns a 404 not found.
If there is already functions inside Zenphoto to do this check, then it would of course be better to use those.
I am actually wondering about that. I will have to consult sbillard on that next week.
Now there is also support for the <lastmod> and <changefreq> (the latter manually only). Also I cleaned up the code to use some function you did manually originally although we have functions for it and additonally there is now finally a "sitemap clear button" on the admin overview page. Because of the strangely not defined `zp_loggedin()` function anyone with overview rights can clear the cache.
Please take a look if you have the time! It's also running on that demo site (called as said via /sitemap.php).
I have been using the site map plugin 2.0 with Zenphoto version 1.2.8 and easily installed it by placing the sitemap.php file in my plugins folder.
I would like to try your new zenphoto-sitemap-extended. I downloaded the nightly (4-5-2010) as suggested and put that sitemap.php file in the plugins folder (also enabled sitemap in admin), but when I tried to access my site it returned errors. Also in the admin plugins "sitemap" simply shows up as "sitemap" it isn't bold followed by a version number like the other plugins. Do I need other updated files besides the sitemap.php?
Thank-you
sitemap.php -> root of Zenphoto were rss.php is for example. This is the actual sitemap file that is called via `/sitemap.php` and generates it.
sitemap-extended.php -> put into `zp-core/zp-extensions` (since it is offficial). These is the actual plugin that provides the functions for sitemap generation.
As mentioned above the split was necessary because of an internal check for album password protection that otherwise does not work.
Note it has only been tested with the nightly and for Zenpage support it requires the nightly because of a change. It is never recommended to mix files from releases.