Skip to content

Latest commit

 

History

History
70 lines (45 loc) · 1.95 KB

README.md

File metadata and controls

70 lines (45 loc) · 1.95 KB

Silverstripe Default Home

Version License

Overview

This modules makes sure that the homepage for a site is always accessible through the URL segment configured in SilverStripe\CMS\Controllers\RootURLController::default_homepage_link (usually 'home'). The module also makes sure that the homepage exists and can't be unpublished or deleted. It also hides the homepage from menus (ShowInMenus=false).

This module supports single site as well as multisites setups.

Requirements

  • SilverStripe CMS 5.x

Note: this version is compatible with Silverstripe 5. For Silverstripe 4, please see the 2 release line.

Installation

Install the module using composer:

composer require innoweb/silverstripe-default-home dev-master

Then run dev/build.

Configuration

For this module to work you need to create a homepage class in your project and this module's HomePageExtension to it:

<?php

namespace Your\NameSpace;

use Innoweb\DefaultHome\Extensions\HomePageExtension;
use Page;

class HomePage extends Page
{
    private static $table_name = 'HomePage';

    private static $singular_name = "Home Page";
    private static $plural_name = "Home Pages";
    private static $description = 'Site home page';

    private static $hide_ancestor = HomePage::class;

    private static $extensions = [
        HomePageExtension::class
    ];

    ...
	
}

Then, the following configuration value needs to be set:

SilverStripe\CMS\Controllers\RootURLController:
  default_homepage_class: Your\NameSpace\Homepage

License

BSD 3-Clause License, see License