Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Add dynamic sites to Google Sitemap?


Reply

16 Posts   2407 Views

Avatar
Webdoc

10 December 2011 at 2:27am Community Member, 332 Posts

my bad forgot to add

public function AbsoluteLink() {
return Director::absoluteURL($this->Link());
}

Avatar
Bereusei

3 May 2012 at 7:39pm Community Member, 94 Posts

He guys,

I have the same problem than danzzz. I generate pages from dataobjects and I need a sitemap-module that add this pages to sitemap.xml and works on Silverstripe 2.4.7.
The link from Willr (https://github.com/silverstripe-labs/silverstripe-googlesitemaps) only contains a module that requires Silverstripe 3.0

Is there somewhere a module for 2.4.7?

Avatar
Ryan M.

3 May 2012 at 8:14pm Community Member, 309 Posts

It should work, I'm using it on one of my 2.4.x sites. Can't remember if I had to make hacks or not though.

Avatar
Bereusei

3 May 2012 at 8:50pm (Last edited: 3 May 2012 8:53pm), Community Member, 94 Posts

Strange, I´ve got this error if I start dev/build?flush=1: Fatal error: Class 'DataExtension' not found in /www/htdocs/xxxx/projekte/mysite-cms2/googlesitemaps/code/GoogleSitemapDecorator.php on line 9

Avatar
Bereusei

3 May 2012 at 8:57pm (Last edited: 3 May 2012 9:04pm), Community Member, 94 Posts

Update - I found this module:
https://github.com/silverstripe-labs/silverstripe-googlesitemaps/tree/0.2

But it doesn´t add the dataobjects as pages right. I´ve got this:
<url>
<loc>
http://furnifocus.de.XXXX.kasserver.com/projekte/XXX-cms2/wohnwelten/garten/
</loc>
<lastmod>2012-03-30T12:13:22+02:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc/>
<lastmod>2012-04-18T16:13:23+02:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.6</priority>
</url>
<url>
<loc/>
<lastmod>2012-04-11T09:56:34+02:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.6</priority>
</url>
<url>
<loc/>
<lastmod>2012-04-13T09:50:40+02:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.6</priority>
</url>

Avatar
Willr

4 May 2012 at 6:09pm Forum Moderator, 5511 Posts

Do your dataobjects have AbsoluteLink methods defined? See the tests for an example https://github.com/silverstripe-labs/silverstripe-googlesitemaps/blob/master/tests/GoogleSitemapTest.php#L98

Avatar
Bereusei

7 May 2012 at 9:23pm Community Member, 94 Posts

Hi Willr,

how can I define the AbsoluteLink method? I´ve tried to add:
public function AbsoluteLink() {
return Director::absoluteURL($this->Link());
}
to my datadobject class, but this has no effect.

I´ve added: public static $google_sitemap_dataobjects = array('Product'); to the GoogleSitemap.php
and I´ve added GoogleSiteMap::register_dataobject('Product'); to my _config.

It still doesn´t work. I´ve tried your module (https://github.com/silverstripe-labs/silverstripe-googlesitemaps) again, but probably it´s only for Silverstripe 3.0.

Avatar
Willr

13 May 2012 at 6:50pm Forum Moderator, 5511 Posts

Bereusei, no the module supports 2.4 with the 0.2 branch (http://www.silverstripe.org/google-sitemaps-module/)

It's quite a simple template, I would debug

public function AbsoluteLink() {
$url = Director::absoluteURL($this->Link());
var_dump($url);

return $url;
}

You should see all your urls. If that happens and the XML source still doesn't have it then try with a ?flush - site.com/sitemap.xml?flush=1. If you don't get a list of URL's then your object hasn't been registered.