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.

General Questions /

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

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

Stopping creation of a "Home" page if there isn't a page called "Home"


Reply


7 Posts   2136 Views

Avatar
MartinPhone

Community Member, 57 Posts

13 May 2009 at 12:51pm

I found one person in the archive who had had exactly this and there were no responses...

I have renamed my homepage to (say) "Terry".

When I dev/build, then SS helpfully creates a new page called "Home" with the "Welcome to Silverstripe bla bla" message and makes that my homepage. This is very annoying!

Why am I forbidden from renaming my homepage? ... No. Hang about, actually I'm not. I *can* rename it. It's a feature! So why then does dev/build make me a new one?

If I just change the navigation name to Terry, then everything is fine.

It's been suggested elsewhere that there's a 'Homepage' tickbox, and in fact I searched for this in the CMS to begin with.

Avatar
Carbon Crayon

Community Member, 598 Posts

13 May 2009 at 10:10pm

You must have a page called home because that is the page SS looks for when someone types in your base domain name. I'm not sure if there is an easy way to change this behavior to look for another page name but certainly not through the CMS interface.

Avatar
MartinM

Community Member, 6 Posts

14 May 2009 at 4:53am

How about changing your "Home"-Page to a redirector page pointing to /terry and making it invisible?

Avatar
Kalileo

Community Member, 127 Posts

17 May 2009 at 4:05pm

Just unpublish that "home" page, but do not delete it.

As long as it's there SS will not mess up the navigation by recreating it (and autopublishing it). Yeah, that useless home page entry clutters the CMS somewhat, but not too much to be a problem.

Avatar
ChrisBryer

Community Member, 95 Posts

4 September 2009 at 2:19pm

i believe you can change the name of the home page and make it work by entering your domain name in the 'Use this page as the 'home page' for the following domains' textfield in the behaviour tab. its been a little while since i played with that feature, but i think i changed home to welcome, entered the domain name in that textfield and everything worked correctly, but again, its been a little while.

Avatar
John Silver

Community Member, 10 Posts

14 September 2009 at 8:19pm

@ChrisBryer: That won't stop the page from being created, but it helped me fix another problem: Before I filled in the domain, I got an error when accessing / on my server. It was somehow related to removing/renaming the "home"-page.

To stop the creation of the "home"-page you may override the function requireDefaultRecords in your page class. I don't know if there are any side effects though.

function requireDefaultRecords() {}

Avatar
DNA

Community Member, 24 Posts

21 September 2010 at 9:38am

I know this is an old post but it seems like there's an another response, which may help some people.

In order to change the Home page URL you can change RootURLController::$default_homepage_link line 16. Set this to the page url you wish to use as the homepage. However, this will not stop a home page being created automatically. You also need to edit SiteTree::requireDefaultRecords that @JohnSilver mentioned.

Why the requireDefaultRecords function doesn't use the variable from RootURLController I don't know.

It is also important to note that if you set the value to a url which does not exist on a Page already it will not create that page automatically for you.

It would be nice if this was configurable from mysite/_config.php, I might bring up a ticket for it and see what response I get.