Appearance
Layouts
Custom default modules
For every page type and every template is possible to set the default modules/values when a new page is created setting the settings default-layouts-modules
, for example:
json
{
"article": {
"default": {
"__roles": [
"main_image",
"sponsor",
"title",
"epigraph",
"main_content_generic",
"paragraph"
],
"main_content_generic": {
"__roles": [
"free_generic"
],
"free_generic": {
"content": "{\"type\": \"Ejemplo\", \"title\": \"Foo 314 Bar 413\"}"
}
}
}
}
}
Snippets (setting esi)
In Xalok Go the templates and layouts are predefined, however it should be possible to insert specific elements in certain positions. An example is the advertising slots.
One way to allow this customization at instance level quickly (but perhaps not the most appropriate), is to create specific positions in which snippets can be inserted as it is done for example with the dataLayer.
A balance must be struck between minimizing the number of positions but being able to create this customization in real time (i.e., add snippets only if it is really necessary).
To create a new snippet we add the configuration to SettingsManager.php
, for example:
php
'snp-header-bottom' => [
'group' => 'snippets',
'editor' => 'code',
'editorOptions' => [ 'language' => 'html' ],
'response_type' => 'text/html',
],
(Interpolation variables can be added if available and necessary)
We create a default fixture (at least in Starbase), for example st4/codata/fixtures/settings-fixtures/snp-header-bottom.txt
:
html
<span style="color: white; background-color: red; font-weight: bold">snp-header-bottom</span>
Include snippet as ESI
Finally, we include the snippet normally by means of an ESI exclusion (although if it depends on variables that we know will be regenerated or force a change of the content it could be inline):
html
{{ wf_cms_render_setting('snp-header-bottom') }} # It renders http://.../setting/render/snp-header-bottom as esi:include
Include snippet as include
html
{{ wf_cms_render_setting_inline('snp-404') }} # It renders the setting saved in the publication moment (It requires to republish in case of change)
Templates (setting inline)
Some customizations require more flexible programmatic control than simply interpolating variables. In those cases it is possible to set up templates (twig) that will be rendered on the fly.
These templates are indicated in settings as template-...
(e.g. template-json-microf-recipe
). Some javascript and snippets settings are rendered as templates too (see detail list at the end).
html
{{ wf_render_twig_template('html-category-topa', _context) }}
In case the template is incorrect, the error will be handled and depending on the context displayed in some way (e.g. for html, the error will be displayed inside a comment).
See Templating.
Templates + esi (setting inline esi)
To render twig templates as ESI, it is possible with wf_render_twig_template_esi function which renders /setting/template/{setting-slug}
html
{{ wf_render_twig_template_esi('html-category-topb') }} # It renders http://.../setting/template/html-page-topb as esi:include
General
snp-logo setting inline(deprecated)
Layout base
- html-layout-html setting inline (template with context)
- html-layout-header-top setting inline (template with context)
- microformat-organization setting esi (deprecated)
- html-layout-header setting inline (template with context)
Header
template-html-header-home setting inline(deprecated)- template-html-header-content setting inline (template with context)
- Dynamic context:
type
home
: only for the homecategory
: category from the page or category sectioncategoyId
, the category id (only for developers)
tag
: tag from the tag section$tagId
, the tag id (only for developers)
template
: the template of the articleunknown
, any other page with extra paramsroute
, the requested route name
- Dynamic context:
- snp-header-bottom setting esi (deprecated, could be or not included in
template-html-header-content
)
Footer
- template-html-footer-content setting inline (template with context)
- Dynamic context:
type
home
, the home footercategory
, the category footer with extra paramscategoyId
, the category id
page
, the pages footer with extra paramscategoryId
, the page category id
unknown
, any other page with extra paramsroute
, the requested route name
- Dynamic context:
Sidebar
template-html-sidebar-detail setting inline (no context) Its used to render the blocks inside an article(deprecated)
Newsletter
template-html-newsletter-detail setting inline (no context)(deprecated)
Home
- html-home-topa setting inline (template with context)
%req_uri% requested uri%pub_url% configured public url%platform%, string,[ web | amp | ... ]
%md5Url%, string, same as %req_uri% but MD5 encoded
- html-home-topb setting inline esi
- AppCmsBundle:Assets:jsHome controller esi
- html-home-topc setting inline esi (template with context)
Category
- template-json-microf-breadcrumbs setting twig (
category
) - html-category-topa setting inline (template with context)
%req_uri% requested uri%pub_url% configured public url%platform%, string,[ web | amp | ... ]
%md5Url%, string, same as %req_uri% but MD5 encoded%title%, string, content title%slug%, string, category slug
- html-category-topb setting inline esi (template with context)
- AppCmsBundle:Assets:jsCategory controller esi
- html-category-topc setting inline esi (template with context)
Page
- template-json-microf-{template} setting twig (
page
) - template-json-microf-breadcrumbs setting twig (
page
) html-page-topa-amp setting inlineDEPRECATED- html-page-topa setting inline (template
page
,sponsor
)%accessLevel%, string, key for the setting mapcontent-access-level
.%ads%, boolean, ads activated%author%, string, content authors%comments%, boolean, comments activated%firstPublishedAt%, string YmdHi, first publishing date%id%, int, content internal id%indexed%, boolean, indexed%lastPublishedAt%, string YmdHi, last publishing date%md5Url%, string, same as %req_uri% but MD5 encoded%platform%, string,[ web | amp | ... ]
%pub_url%, string, this site base url%req_uri%, string, requested url%section1%, string, root category%section2%, string, child category (if any)%section3%, string, grandson category (if any)%sponsor%, string, sponsor name (if any)%sponsored%, boolean, if marked as sponsored%tags%, string, CSV tags%tagstitles%, string, CSV tags titles%template%, string, layout template internal name[ default | receta | galeria | ... ]
%title%, string, content title%videos%, int, number of total video content models%words%, int, content word count using Word Counting
- html-page-topb setting inline esi
- AppCmsBundle:Assets:jsArticle controller esi
- html-page-topc setting inline esi
- html-page-bodya[-amp] setting inline
%req_uri%, string, requested url
- html-page-bodyb[-amp] setting inline
%req_uri%, string, requested url
404
- html-404-topa, setting inline (template wit context)
- snp-404, setting inline
Author
- html-author-topa setting inline (template with context)
%req_uri% requested uri%pub_url% configured public url%firstName%%lastName%
- html-author-topb setting inline esi (template with context)
- AppCmsBundle:Assets:jsCategory controller esi
- html-author-topc setting inline esi (template with context)
- snp-roba-4 setting inline (template with context)
- snp-roba-5 setting inline (template with context)
Search (index)
- html-search-topa setting inline (template with context)
%req_uri% requested uri%pub_url% configured public url%platform%, string,[ web | amp | ... ]
%md5Url%, string, same as %req_uri% but MD5 encoded
- html-search-topb setting inline esi
- AppCmsBundle:Assets:jsHome controller esi
- html-search-topc setting inline esi (template with context)
- snp-megabanner setting inline (template with context)
- snp-roba-4 setting inline (template with context)
- snp-roba-5 setting inline (template with context)
Temas (index)
- html-temas-topa setting inline (template with context)
%req_uri% requested uri%pub_url% configured public url%platform%, string,[ web | amp | ... ]
%md5Url%, string, same as %req_uri% but MD5 encoded
- html-temas-topb setting inline esi (template with context)
- AppCmsBundle:Assets:jsCategory controller esi
- html-temas-topc setting inline esi (template with context)
- snp-megabanner setting inline (template with context)
Letter (index)
- html-letter-topa setting inline (template
current_letter
,all_letters
, _context)%req_uri% requested uri%pub_url% configured public url%platform%, string,[ web | amp | ... ]
%md5Url%, string, same as %req_uri% but MD5 encoded
- html-letter-topb setting inline esi (template with context)
- AppCmsBundle:Assets:jsCategory controller esi
- html-letter-topc setting inline esi (template with context)
- snp-megabanner setting inline (template with context)
Archive
- html-archive-topa setting inline (template
date
,date_formatted
, _context)%req_uri% requested uri%pub_url% configured public url%platform%, string,[ web | amp | ... ]
%md5Url%, string, same as %req_uri% but MD5 encodeddate_yyyymmdd, string, archive date with iso formatdate_formatted, string, archive date with human format
- html-archive-topb setting inline esi (template with context)
- AppCmsBundle:Assets:jsCategory controller esi
- html-archive-topc setting inline esi (template with context)
- snp-megabanner setting inline (template with context)
- snp-roba-4 setting inline (template with context)
- snp-roba-5 setting inline (template with context)
Tag
- html-author-topa setting inline (template
tag
, _context)%req_uri% requested uri%pub_url% configured public url%slug% tag slug%title% tag title
- html-tag-topb setting inline esi (template with context)
- AppCmsBundle:Assets:jsCategory controller esi
- html-tag-topc setting inline esi (template with context)
- snp-megabanner setting inline (template with context)
- snp-roba-4 setting inline (template with context)
- snp-roba-5 setting inline (template with context)