Skip to content

A simple module that creates a Home Page per website or MultiSites Site.

License

Notifications You must be signed in to change notification settings

xini/silverstripe-default-home

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 and configured-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

About

A simple module that creates a Home Page per website or MultiSites Site.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages