About themes and multitenancy¶
Themes provide templates for the customization of the appearance and functionality of your public-facing websites. Themes can also be translated to support multiple written languages and regional dialects.
The Superdesk Publisher themes system is built on top of fast, flexible and easy to use Twig templates.
By default, themes are located under the app/themes
directory. A basic theme must have the following structure:
1 2 3 4 5 6 7 8 9 10 11 12 13 | ExampleTheme/ <=== Theme starts here
views/ <=== Views directory
home.html.twig
translations/ <=== Translations directory
messages.en.xlf
messages.de.xlf
screenshots/ <=== Theme screenshots
front.jpg
public/ <=== Assets directory
css/
js/
images/
theme.json <=== Theme configuration
|
Publisher does not support the option of Sylius theme structure to have bundle resources nested inside a theme.
Superdesk Publisher can serve many websites from one instance, and each website tenant can have multiple themes. The active theme for the tenant can be selected with a local settings file, or by API.
If only one tenant is used, which is the default, the theme should be placed under the app/themes/default
directory, (e.g. app/themes/default/ExampleTheme
).
If there were another tenant configured, for example client1
, the files for one of this tenant’s themes could be placed under the app/themes/client1/ExampleTheme
directory.
Superdesk Publisher provides an easy way to create device-specific templates. This means you only need to put the elements in a particular template which are going to be used on the target device.
The supported device types are: desktop, phone, tablet, plain
.
A theme with device-specific templates could be structured like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ExampleTheme/ <=== Theme starts here
phone <=== Views used on phones
views/ <=== Views directory
home.html.twig
tablet <=== Views used on tablets
views/ <=== Views directory
home.html.twig
views/ <=== Default templates directory
home.html.twig
translations/ <=== Translations directory
messages.en.xlf
messages.de.xlf
screenshots/ <=== Theme screenshots
front.jpg
public/ <=== Assets directory
css/
js/
images/
theme.json <=== Theme configuration
|
Note
If a device is not recognized by the Publisher, it will fall back to the desktop
type. If there is no desktop
directory with the required template file, the locator will try to load the template from the root level views
directory.
More details about theme structure and configuration can be found in the Sylius Theme Bundle documentation.