innoweb/silverstripe-default-home

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

Installs: 714

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 2

Open Issues: 0

Type:silverstripe-vendormodule

3.1.1 2024-02-26 23:37 UTC

This package is auto-updated.

Last update: 2024-02-26 23:38:58 UTC


README

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