Problem/Motivation
Site builders ask for an easy way to build the homepage with a page layout.
Today it takes a conditional layout with a Pages condition on <front>, dragged to the top of the list, as the Build a homepage tutorial explains.
A conditional layout above it on /node/* takes the front page when that is set to /node/1.
Proposed resolution
A homepage is a page layout whose only condition is Pages <front>, as the default is one with none, so no config key is added.
A "Create the homepage" action next to the default one saves it with a fixed ID and label, a locked condition and a Minimal or Blank starting point, and shows the current front page.
The homepage is checked first and the default last, whatever their weight.
<front> follows the front page setting on every request, and saving that setting already invalidates the rendered cache.
Remaining tasks
PageLayoutInterface::isHomepage(), and the homepage sorted first inAccessControlHandler::loadCurrentPageLayout().- Route, action and access for the homepage, offered while the site has none.
PageLayoutForm: the homepage mode.- Page layouts list: homepage rows on top, not draggable.
- Docs:
build-a-homepage.mdStep 6 andpage-layout.md. - Tests: kernel for
isHomepage()and the order, functional for the homepage action.
User interface changes
A "Create the homepage" action on the page layouts list, and the homepage rows on top of it.
API changes
PageLayoutInterface::isHomepage() is added.
Data model changes
None.
Issue fork display_builder-3632193
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mogtofu33 commentedComment #5
mogtofu33 commentedComment #7
pdureau commented