Elements generated on theme installation¶
To provide better experience for end users after theme installation Publisher can create some default content used by theme. Thanks to this feature theme developer can be sure that all of his article or category templates will be visible without complicated configuration by end user.
Generated elements can be declared in theme.json config file under generatedData
key. Example:
1 2 3 4 | {
"name": "my/custom-theme",
"generatedData": { ... }
}
|
Theme generators supports now those elements: routes
, menus
and contentLists
.
All elements have this same properties as are supported by API requests, plus few extra like:
- in routes:
numberOfArticles
- number of fake articles generated and attached to route- in menus:
children
- array of child menus attached to parent one
Example routes block¶
1 2 3 4 5 6 7 8 9 10 11 | "generatedData": {
"routes": [
{
"name": "Politics", # required
"slug": "politics", # optional
"type": "collection", # required
"templateName": "category.html.twig", # optional
"articlesTemplateName": "article.html.twig", # optional
"numberOfArticles": 1 # optional (number of articles generated and attached to route)
},
...
|
Example contentLists block¶
1 2 3 4 5 6 7 8 9 10 11 | "generatedData": {
"contentLists": [
{
"name": "Example automatic list", # required
"type": "automatic", # required
"description": "New list", # required
"limit": 5, # optional
"cacheLifeTime": 30, # optional
"filters": "{\"metadata\":{\"located\":\"Porto\"}}" # optional
}
...
|