Zenphoto Google Sitemap

I think it’s cool to help Google bot crawl my gallery. So I create this dynamic Google sitemap generator for ZenPhoto. First, this script will select all albums, then list all pics from that album, and will recursively do so for aech of the subalbums. I put the priority 0.5 (as what is defined as default priority by Google here) and put and changefreq as never (this is optional, maybe someone can enhance on this).

How to install:

There is a readme file in the ZIP, just in case:

1. Extract it, upload the file sitemap.php to zp-core.

2. At the root folder of gallery, find .htaccess file and add the following line:

RewriteRule ^sitemap\.xml$ zp-core/sitemap.php [L,QSA]

add it exactly below this line:

RewriteEngine On

Save and reupload the .htacess file.

Then you can access your sitemap at www.domain.com/gallery/sitemap.xml

Download:

zenphoto-google-sitemap

Demo:

http://basri.my/gallery/sitemap.xml

16 Responses to Zenphoto Google Sitemap

  1. Joe says:

    Hi

    Thanks for the sitemap, I noticed that you have hardcoded the url to your site, It would be better if you sniff it from the install or at least make sure that you mention in your write up that users need to edit this line to make it work.

    cheers
    joe

  2. Basri MY says:

    Thanks Joe. It just got fixed.

  3. VV666 says:

    Hi, I have more exploration error. Sitemap plugin add “.php” extention at the end of links as “MyImage.jpg.php”
    Why ? Is-it a bug ?

    Thx

  4. VV666 says:

    Sorry for the triple comment, but it is impossible to edit previous comments.

    I made hack of the file so that Googlesitemap can use them, but it is temporary (line 95).
    Here is the address of the sitemap with my hack: http://atelierboucher.fr/zp-core/sitemap.php
    and address of the sitemap of origin: http://atelierboucher.fr/zp-core/sitemap_origin.php
    For my website, this plugin does not understand the albums files, add an extension. Php in image and does not include pages created with the plugin zenpage (built since 1.2.5). It’s a real shame.

    I do not have sufficient knowledge to modify your plugin.
    I hope you get there.
    Thank you in advance.

  5. Stephane says:

    Hello, I have left 3 comments with the pseudo VV666, why did it disappear?

  6. Basri MY says:

    hi Stephane,
    your comments were in moderation list.

    If you can comment this line on top of the file:
    $ZenUrl=str_replace(‘/zp-core/sitemap.php’, ”, getaddress());

    (comment by // at the beginning)

    then enter a new line just below it:
    $ZenUrl=”http://atelierboucher.fr”;

  7. Stephane says:

    Hello, thank you for your help.
    I add this: $ ZenUrl = “http://atelierboucher.fr/albums”;

    It finds the urls, but always adds .php at the end of pictures and the pictures are not visible.

    Finally, to display the xml sitemap, I must always go to http://atelierboucher.fr/zp-core/sitempa.php instead of http://atelierboucher.fr/albums/sitempa.xml

  8. Basri MY says:

    Hi Stephane,
    I would suggest 3 lines of modification for you. It is hard coded style may not be usable by other though.

    1. On top of the file, change $ZenUrl to this line:

    $ZenUrl=”http://atelierboucher.fr/”;

    2. Find this line:

    $url=myslash($ZenUrl).urlencode($picline[2]).’/';

    change it to:

    $url=”http://atelierboucher.fr/index.php?album=”.urlencode($picline[2]);

    3. Find this line:

    $url=myslash($ZenUrl).urlencode($albumname).’/’.urlencode($picline[0]).”.php”;

    change it to:

    $url=”http://atelierboucher.fr/index.php?album=”.urlencode($picline[2]).”&image=”.urlencode($picline[0]);

    Additionally, in order to have
    http://atelierboucher.fr/zp-core/sitemap.php

    to be accessible at

    http://atelierboucher.fr/albums/sitemap.xml

    you nee to follow the instruction on top of the page about changing .htaccess

  9. Stephane says:

    Thank you.
    I make the changes and now it finds most of the pages (not found 6).
    For against, the amendment of. Htaccess as mentioned did not solve my problem but that’s OK, Google is still the sitemap.

    Do you know why your extension is not valid for me? Is this due to my location in France? (and thus the translation of the application).

    Thank you very much for your help.

  10. Nigel Aves says:

    Dear Basri,

    I’m using Zen Photo 1.2 (I’m really new to Zen Photo) and I think they have changed some file locations.

    The line include(“zp-config.php”); needed to be changed to include(“../zp-data/zp-config.php”);

    But I have something strange going on with the generated URLs

    http://serendipity.soft-focus-imagining.com/Michelle%2FMichelle+-+colour/Michelle_in_colour_029.jpg.php

    between Michelle and Michelle+-+color is “%2F” and this should really be a “/” as these are both albums.

    I’m not a programmer so did not know where to start looking.

    Take Good Care – Nigel.

  11. Nigel Aves says:

    Dear Basri,

    As I’ve said I’m no programmer but I was able to add a hack.

    I added:

    $url = preg_replace(‘/%2F/’, ‘/’, $url);

    just after line 66 and 96

    I does correct the URL but it’s not exactly elegant!

    Nigel

  12. Merlin74 says:

    I know how to solve the issue though. ,

  13. [...] More info and download No comments [...]

  14. Onore says:

    Photos from ZenPhoto have a very bad result in the Google.Images Search. And I don`t think – SiteMap changes this tendensions…

    Could you give any link to site based on ZenPhoto and has top result in Google.Images?
    Sorry for my @cool@ English =)

  15. fabian says:

    I got this message when I tried to get the sitemap.xml

    Warning: include(zp-config.php) [function.include]: failed to open stream: No such file or directory in /hermes/bosweb/web059/b591/ipw.fabortiz/fabortiz.com-redirect/zenphoto/zp-core/sitemap.php on line 14

    Warning: include() [function.include]: Failed opening ‘zp-config.php’ for inclusion (include_path=’.:/usr/local/lib/php-5.2.12/lib/php’) in /hermes/bosweb/web059/b591/ipw.fabortiz/fabortiz.com-redirect/zenphoto/zp-core/sitemap.php on line 14

    Warning: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) in /hermes/bosweb/web059/b591/ipw.fabortiz/fabortiz.com-redirect/zenphoto/zp-core/sitemap.php on line 50
    Could not connect : Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

    Any idea why I got this?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>