Recent Topics

[Hack] [1.8] UPDATED! Google Sitemap Generator v1.1

Started by on Jul 14, 2006 – Contents updated: Jul 14, 2006

Jul 14, 2006 21:45    

I had been looking for a sitemap generator for quite a while and I decided to make my own referencing other code for previous generators. Basically I set it up as a skin, just like the RSS feeds. The only thing I wasn't sure about was how to get all of the entries for a blog, but I ended up just pulling a new "ItemList." If anyone has any suggestions, I would be glad to update it. The install is very simple, just put the folder "_sitemap" in your skins folder and put the file "sitemap.php" in your root directory with "index.php" and "rss.php." This is required by Google, so the "sitemap.php" file cannot be placed anywhere else.

Once the files are correctly placed, you need to submit your sitemap to google. The proper URL will be similar to:

http://yourserver.com/blogs/sitemap.php?blog=5


Make sure that the blog number you specify is the number corresponding to the blog you want to track. You can put "blog=1" to have good crawl the "All Entries" blog, but the main page of your blog may not be indexed correctly. When I tried using "blog=1," the sitemap gave the main page URL as

http://yourserver.com/blogs/index.php/all

If you have any other questions, please feel free to post and ask.

If there is some interest in this, I could put together a more formal instruction set and documentation.

EDIT: Thanks to Blueyed's suggestions, I updated the generator and uploaded a new version. Thanks again Blueyed!

Oct 09, 2006 01:22

I've started a Google Sitemaps plugin for b2evo 1.9 and used your source as inspiration.

Some remarks therefor:


$MainList = & new ItemList( $blog, array('published'), '', '', -1, '', array(), '', 'DESC', '', '50000', '1', '', '', '', '', '', 0, 'posts' );


seems better. The 50000 is mentioned in Google's XML schema and I've changed some params.

You should use $MainList->get_next() instead of ->get_item().


<lastmod><?php $Item->mod_date( 'isoZ', true ) ?></lastmod>


gives the full datetime and uses GMT.

Apart from that it looks fine.. Thanks. :)

Oct 09, 2006 01:34

blueyed, thanks a lot for taking interest. I'm really glad that you guys could use this to make a new plugin for version 1.9. Admittedly I didn't really study the API very thoroughly before I got going, but the code was very intuitive and easy to adapt.

Thanks for the suggested changes, I'll make them and update the post so that others can use them as well. I hadn't really expected anyone else to take much of an interest, but I'm honored that I could help out the project!

Dec 04, 2006 02:26

I installed this (the updated version) on my domain www.citysourceusa.com and it worked like a charm! I thank you for the code. Well done!

Dec 05, 2006 23:16

It was no problem at all. Eventually if you want something bad enough, you just go ahead and make it yourself!

Jan 19, 2007 15:53

thanks for the code!

i was just doing this exact same thing myslef, and i came to the forum looking for a solution to dumping all the posts, instead of the last n posts..

looks like you did all the work for me..

thanks!

Mar 30, 2007 19:29

kf_man wrote:

I had been looking for a sitemap generator for quite a while and I decided to make my own referencing other code for previous generators. Basically I set it up as a skin, just like the RSS feeds. The only thing I wasn't sure about was how to get all of the entries for a blog, but I ended up just pulling a new "ItemList." If anyone has any suggestions, I would be glad to update it. The install is very simple, just put the folder "_sitemap" in your skins folder and put the file "sitemap.php" in your root directory with "index.php" and "rss.php." This is required by Google, so the "sitemap.php" file cannot be placed anywhere else.

Once the files are correctly placed, you need to submit your sitemap to google. The proper URL will be similar to:

http://yourserver.com/blogs/sitemap.php?blog=5


Make sure that the blog number you specify is the number corresponding to the blog you want to track. You can put "blog=1" to have good crawl the "All Entries" blog, but the main page of your blog may not be indexed correctly. When I tried using "blog=1," the sitemap gave the main page URL as

http://yourserver.com/blogs/index.php/all

If you have any other questions, please feel free to post and ask.

If there is some interest in this, I could put together a more formal instruction set and documentation.

EDIT: Thanks to Blueyed's suggestions, I updated the generator and uploaded a new version. Thanks again Blueyed!

hi.
How can i use it with b2evo 1.9.3?

Does it work with the option "explicit reference to stub file" enabled?

Thanx


Form is loading...

Social CMS software – This forum is powered by b2evolution CMS, a complete engine for your website.