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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

New Home Page on each build


Go to End


5 Posts   930 Views

Avatar
Zile

Community Member, 3 Posts

8 March 2015 at 2:54pm

I have tried searching for answer, but with no luck... Just started my first site on localhost, for learning. Everytime I rename my home page, the new one gets created on dev/build.
Is it possible to have 'page name' and 'navigation label' other than "Home"?
Anyone had a similar issue?

Avatar
Nightjar

Community Member, 28 Posts

9 March 2015 at 11:50am

Edited: 09/03/2015 11:50am

Yes. This is an unfortunate thing, and I'm not sure how to get around it myself, but the answer (work-around) is to simply ensure that the URLSegment remains 'home' (change the page/menu title to whatever you like).

Avatar
Zile

Community Member, 3 Posts

9 March 2015 at 11:58am

Thank you, Nightjar. It's easy when you know how to do it :-)
I just wish if it was better documented for starters like me. Once again - thanks a lot!

Avatar
innoweb

Community Member, 9 Posts

10 March 2015 at 10:52am

Hi Zile,

Just use the following class as home page:

class HomePage extends Page {
	public function onBeforeWrite() {
		parent::onBeforeWrite();
		$this->URLSegment = 'home';
	}
}

class HomePage_Controller extends Page_Controller {
}

This sets the url to 'home' each time the page gets saved.

Avatar
Zile

Community Member, 3 Posts

10 March 2015 at 1:25pm

Magic!

Thank you innoweb!!!