The Menu item Theming -> Blocks allows you to drag and drop blocks into the different regions of your Themes.
On the left hand side are the blocks defined by the system, grouped by block providers.
Define your blocks for the default layout, from which blocks will be pulled for every layout that doesn't have blocks defined. If you need a different set of blocks for other layouts, you can copy the current layout into another type of layout.
This plugin comes with the following type of blocks :
- Category : choose a category and a view mode to render
- Content : Main content of the page, should be present on each layout
- Current user : Display information about the current user
- Entry : Choose a entry and a view mode to render
- Global : Choose a global set and a view mode to render
- Messages : Renders the session messages stored in 'notice' and 'error' session flash data
- Site name : Displays the site name
- Template : Renders a custom template
- Twig : Renders some custom twig code
- User : Choose a user and a view mode to render
- Login form
- Profile form
- Register form
- Reset password form
- Search form
- Set password form
Blocks will be included in the project config, but for the blocks that reference an element the information will not be saved in the project config (because elements are different from an environment to another), those are : Entry, Category and User. Those blocks will need to be resaved in the new environment they are deployed to, to reference the correct element.
This can be a problem on some setups as it will create project config changes that might be irrelevant from an environment to another. There is no solution for that yet, but you could avoid using such blocks and use a template block instead where you fetch and display what you need
You can choose a cache strategy for each block which defines how the block is cached. This plugin comes with 3 strategies :
- Global : Will cache the same block for all urls
- Url path : Will cache separately or each url path
- Url path (with query) : Same as above but will also look at the query string
Each of those strategies can be set to cache differently whether the user is logged in or out, or cache differently for each logged in user or their view ports (mobile, tablet or desktop).
Block caching uses Craft internal cache tagging system so cache will be automatically invalidated when elements used within a block are changed.
The content block is a special case, it will load on the page the displays defined for the associated layout, it should be present on every page.
Caching on this block should be done carefully as it will impact all displays. Setting the global strategy for example should be avoided entirely, or you would see the same content for every page.
Setting no cache strategy to the content block will effectively disable the displayer cache which is not recommended.