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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

exclude page(s) from google sitemap programmatically?

Go to End

3 Posts   1755 Views


Community Member, 203 Posts

3 June 2010 at 1:14am

Hi, is there a way to exclude a page-class from the sitemap.xml with a line of php code? I know this can be done by hand, but I want a certain page type to not show up at all, without user interference.


Community Member, 203 Posts

4 June 2010 at 7:17pm

Got it:

Templates and pages who do not show up in search (even when search is not implemented on the site) do also not show up in the sitemap.xml. To make this the standard you could add the folowing code to your classes:

static $defaults = array(
		"ShowInSearch" => 0

And you could add this to your getCMSFields()



Community Member, 24 Posts

25 September 2010 at 12:41pm

Or if you want the page to stay in search but be removed from sitemap then:

	protected function onBeforeWrite() {
		$this->Priority = '-1';