I'm looking for a way to register a view that basically registers a configuration of blocks against my content type. Either through the web or in code.
You can create, through the web, a Volto page with blocks. In Plone classic, when you edit that page, you'll see the "Layout" fieldset with the blocks and blocks_layout fields. You can copy those to your component view code. You can pass a content={{blocks, blocks_layout}}
to the RenderBlocks
component, see here:
For details on how to register the view as a layout view, check this:
Creating Volto Views – Frontend – Development recipes — Plone Documentation v6.0. It's also possible to register it for a content type, plug it into the config.views.contentTypeViews
, see https://github.com/plone/volto/blob/330f945820fb77cd9b029e0dd8001ead30f6784c/src/config/Views.jsx#L103-L108
You get a single layout per content type rather than multiple views in classic or mosaic.
Once I've fully grokked all of this, I'll have to put together a resource with a few pictures and examples to save my future self the 4 or so hours my present self is about to lose this week.
You may want to have a look at the layout editor.
The layout editor allows to create a predefined layout (some blocks…) per content type.
You can access it via the content types control panel.
My favorite conference speaker @avoinea made a nice talk about it: https://youtu.be/vapERru7WOI?si=PZgye7b3aQSQppIR&t=683