Below, we will attempt to answer some frequently asked questions about Deco, Blocks and Tiles.
You may have realised that it is possible to “theme” a site using site layouts, by placing global elements and branding on the site layout itself.
This may be appropriate for simple sites with minimal branding needs: as a rule of thumb, if you think you could construct your branding with the Deco visual editor only, using site layouts to contain your visual identity may be appropriate.
There are some caveats, however:
Hence, we would generally recommend that you keep your site layouts as semantic and simple as possible, and apply a visual identity using `Diazo`_ and `plone.app.theming`_. Deco and Diazo are designed to work together, with Deco focused on site layout as it pertains to content management and editing, and Diazo focused on branding and theming.
In Plone 3 and 4, viewlets are used for two purposes:
The first of these is problematic in a some ways. For example, it relies on a mixture of global registration (ZCML) and local, persistent configuration (the viewlets.xml GenericSetup import step) to control what is shown and in what order. It also makes it difficult to understand how the final page will look by inspecting main_template.
Hence, this pattern of using viewlets is superseded by tiles. Tiles are simply placed into the relevant site layout. The ordering of tiles is controlled by the ordering of the relevant tile placeholders. As a bonus, tiles are easier to write than viewlets and can have associated configuration.
The second use of viewlets is entirely legitimate, of course. Here, specific ordering should matter less (a third-party add-on cannot know which other third-party add-ons may be adding content in the same viewlet managers), and the focus becomes on semantic or semi-semantic locations on the page in which viewlets can be inserted. This is indeed closer to the original purpose of viewlets.
For this pattern, there is a tile called @@plone.app.standardtiles.viewletmanager, which looks up and renders a viewlet manager. For example, the default sitelayout in Deco contains:
<link rel="tile" target="abovecontent-viewlets"
href="./@@plone.app.standardtiles.viewletmanager/above-content?manager=plone.abovecontent" />
Note that the tile takes a parameter, manager, giving the name of the viewlet manager to look up and render. For viewlet managers rendered in the head of the page, we use:
<link rel="tile"
href="./@@plone.app.standardtiles.viewletmanager?manager=plone.htmlhead&section=head" />
This ensures the contents of the viewlet manager are rendered in the <head /> of the tile, not the <body />.
Portlets should likely be replaced by tiles. This will require some refactoring, as tiles are considerably simpler than portlets. This simplicity is a good thing though: tiles are faster and easier to write and much easier to understand.
There is a conceptual difference too: Instead of having portlet managers that acquire and block portlets from the content hierarchy, the sort of content and dynamic behaviour that is managed in portlets in Plone 3 and 4 would instead be modelled by tiles placed directly onto the appropriate site layout(s).
If the situation warrants, the relevant tile could of course use some more abstraction e.g. to model inheritance of settings. In most cases, this should not be necessary, though: websites generally have only a handful of different layouts, which in Plone 4 sometimes require an elaborate dance of portlet assignment, inheritance and blocking.
To users, there is really no distinction between app tiles used for things like a navigation tree or a listing of news items (both of which are portlets in Plone 4) and app tiles used for things like a poll or content listing on a page. With Deco-managed site layouts, tiles can be placed onto the layout wherever they are most appropriate, and there is no need to write ZCML and/or Python code to insert another portlet manager if you don’t have a three-column layout.
There is, however, a “legacy” tile that can be used to render a the contents of a portlet manager, thus allowing existing portlets to be managed and rendered in the same way they are in Plone 4. For example:
<link rel="tile" target="left-portlets"
href="./@@plone.app.standardtiles.portletmanager/left-portlets?manager=plone.leftcolumn" />
Traditionally, achieving a particular non-trivial layout in a way that is consistent site wide has required the creation of a new content type. With Deco and page categories, many existing types can be thought of simply as pages with different layouts.
For example:
Plone 4 type | Deco equivalent |
---|---|
Page | The standard page type with a simple default layout. |
Event | A new category of page with a template page layout that includes the relevant metadata field tiles such as start and end dates. |
News Item | A new category of page with a layout that places a lead image underneath the title. |
Folder | Pages can have sub-pages. This replaces the insanely confusing (to most users) “default page” concept. If you need a folder listing, you can place a folder listing tile on the page. |
Collection | The collections query builder is a tile: hence, a Collection becomes simply a page with an instance of that tile on it. |
Of course, page categories are treated as first-class content types everywhere in Plone, so they can used in catalog queries, for example.
The remains are:
The grid system we are currently looking at, Bootstrap, does offer some level of support for variable-width layouts. With some work you could change the grid system used by deco to suite your needs.
There’s nothing about the new approach that is less accessible than the previous approach in Plone 4. You can always choose to give up the layout model and write HTML/STX/reST/Markdown etc. instead, which is probably a better approach at least for blind people. That being said, you can tab between different tiles when you edit, and it should be possible to get most of it working even from an accessibility perspective.
We’ll be using two terms to talk about this, just so we don’t get confused:
In a nutshell, we’re moving as much as we can of the layout responsibilities outside of the contentEditable (think TinyMCE) implementations in the different browsers.
So what does this mean? It means that pretty much any editor can perform the required tasks, since we are de-scoping its responsibilities quite extensively.