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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Add dynamic sites to Google Sitemap?


Go to End


16 Posts   7100 Views

Avatar
Webdoc

Community Member, 349 Posts

10 December 2011 at 2:27am

my bad forgot to add

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

Avatar
Bereusei

Community Member, 96 Posts

3 May 2012 at 7:39pm

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.

Community Member, 309 Posts

3 May 2012 at 8:14pm

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

Community Member, 96 Posts

3 May 2012 at 8:50pm

Edited: 03/05/2012 8:53pm

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

Community Member, 96 Posts

3 May 2012 at 8:57pm

Edited: 03/05/2012 9:04pm

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

Forum Moderator, 5523 Posts

4 May 2012 at 6:09pm

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

Community Member, 96 Posts

7 May 2012 at 9:23pm

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

Forum Moderator, 5523 Posts

13 May 2012 at 6:50pm

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.

Go to Top