Jump to:

23355 Posts in 17838 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Stopping creation of a "Home" page if there isn't a page called "Home"

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

Page: 1
Go to End
Author Topic: 2034 Views
  • MartinPhone
    Avatar
    Community Member
    57 Posts

    Stopping creation of a "Home" page if there isn't a page called "Home" Link to this post

    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.

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Stopping creation of a "Home" page if there isn't a page called "Home" Link to this post

    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.

  • MartinM
    Avatar
    Community Member
    6 Posts

    Re: Stopping creation of a "Home" page if there isn't a page called "Home" Link to this post

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

  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: Stopping creation of a "Home" page if there isn't a page called "Home" Link to this post

    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.

  • ChrisBryer
    Avatar
    Community Member
    95 Posts

    Re: Stopping creation of a "Home" page if there isn't a page called "Home" Link to this post

    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.

  • John Silver
    Avatar
    Community Member
    10 Posts

    Re: Stopping creation of a "Home" page if there isn't a page called "Home" Link to this post

    @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() {}

  • DNA
    Avatar
    Community Member
    24 Posts

    Re: Stopping creation of a "Home" page if there isn't a page called "Home" Link to this post

    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.

    2034 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.