# SectionDefinitions Flags
The following are the features flags that can be used when defining a section in the Tenant's definition.json file.
# configuration
Enables further options regarding the extraction and the UI elements of a section.
For example, it can be used to add specific whitelist
or to use a different whiteCollarScript
that applies only to a section.
Values: Object
Example:
{
...,
"title": "Title of the awesome example site",
"uri": "www.example.com",
"sectionDefinitions": [{
"name": "home",
...,
"configuration": { ... },
"feedDefinitions": [{
"uri": "https://www.example.com",
"alibabaDefinition": {
"configuration": { ... }
}
}]
},
...
],
...
}
TIP
configuration
can be directly inside a section definition object, or inside a specific feedDefinitions
item, depending on the specificity desired.
# cronRefresh
Defines the frequency of section reloads according to cronmaker (opens new window).
- Type:
string
- Default: Every hour (randomly at different exact times for each site, to balance the load on our servers)
- Format: Must be a cron expression (opens new window).
When added in the configuration
of SectionDefinition, it will affect only that section.
WARNING
Notice that the flag is in the configuration of the sectionDefinition
, not inside the feedDefinitions
nor alibabaDefinition
.
Example:
{
"name":"news",
"styles":"main",
"title":"News",
"configuration":{
"cronRefresh":"0 0/3 * 1/1 * ? *"
},
"feedDefinitions":[{
"uri":"https://www.example.com/example",
"alibabaDefinition":{}
}]
}
WARNING
If you need to change the frequency of all sections, see this article
# disabledEnvironments
Disables a section (hides it completely from the menu, lateral and top) in a specific environment.
Values: Integer
- 1: browser
- 2: native
- 3: both browser and native
Example:
{
...,
"title":"Title of the awesome example site",
"uri":"www.example.com",
"sectionDefinitions":[{
"name":"home",
...
"disabledEnvironments": 2,
...
}]
},
...
],
...
}
# level
Creates subsections. These are compilable pages that relate to a parent menu item. They will appear only on the lateral menu.
WARNING
Only up to two levels of depth are allowed.
+ Section
+ Level 1 SubSection
+ Level 2 SubSection
Values: Number
Example:
{
...,
"title":"Title of the awesome example site",
"uri":"www.example.com",
"sectionDefinitions":[{
"name":"home",
...
"level": 1,
...
}]
},
...
],
...
}
# Logo
When enabled, we can define an src
, height
and width
to add an image in the left side of the section name on the lateral menu.
Values: Object (src, height, width)
Example:
# Logo with section title
{
...,
"sectionDefinitions":[{
"name": "section-name",
"title": "Section Title",
"features": {
"logo": {
"src": "https://example.com/files/example-logo.png",
"width": 16,
"height": 16
}
}
},
...
],
...
}
# Logo without section title
If the title is a blank space and you define a logo, you can make it wider: it will take the title’s space.
{
...,
"sectionDefinitions":[{
"name": "section-name",
"title": " ",
"features": {
"logo": {
"src": "https://example.com/files/example-logo.png",
"width": 16,
"height": 16
}
}
},
...
],
...
}
TIP
UX team usually prepares those logos, if they don’t already have an appropriate size on the tenant’s website.
The recommended size for squared logo is 16x16px. For non-square logos, an approximate height of 16px and its equivalent width is recommended.
# Page patterns
In order to show section pagination identify the pages of a section, we need to specify at least one page pattern. It's a regular expression that should match with the pages and gives us the section's page we're extracting (the matching group ([0-9]+)
is responsible for that)
{
...,
"sectionDefinitions":[{
...,
"pagePatterns": [{
"pattern": ".*/page/([0-9]+)"
}]
...
},
...
],
...
}
TIP
As pagePatterns is an array, you can configure as many patterns you need, check section pagination documentation (how do I insert a link to the documentation we have on gutenberg?)
# promotedForRecirculation
When set to false, the section will not be promoted in the article pages section preview.
Values: True/False. Defaults to true
.
Example:
{
...,
"sectionDefinitions":[{
"name": "section-name",
...,
"features": {
"promotedForRecirculation": false,
...
}
},
...
],
...
}
# showInSectionsIndicator
When enabled, the section will appear always in the section indicator (i.e. top menu). Useful to add external sections, which only appear on the lateral menu by default.
Make sure you load more than one non-external section in local so that you see the items in the top menu. Loading only one non-external section won’t make it work.
Values: True/False
Example:
{
...,
"sectionDefinitions":[{
"name": "section-name",
...,
"features": {
"showInSectionsIndicator": true,
...
}
},
...
],
...
}
# styles
Specifies a selector that can be used to apply styling changes to the menu item.
Values: String
Example:
{
...,
"title":"Title of the awesome example site",
"uri":"www.example.com",
"sectionDefinitions":[{
"name":"section-name",
...
"styles": "mrf-example",
...
}]
},
...
],
...
}
# type
Defines the page type of a menu item.
Values: String. Must be one of:
DEFAULT
: This is the default type of page which lists the different articles of the section. This page is compilable.DYNAMIC
: Used to marfeelize section pages whose link follows a pattern, such as/tag/
or/author/
. These pages are not compilable.EXTERNAL
: Links to a page that is either not marfeelizable or that belongs to another tenant. It appears only on the lateral menu by default. To add it on the top menu as well, see theshowInSectionsIndicator
flag. These pages are not compilable.GROUP
: Relates menu items to a parent. It does not appear on the top menu, and the parent doesn't use a URI. Besides, unlike usingSUBSECTION
orlevel
, it does not include an "All articles related to all subsections" page. These pages are not compilable.STATIC
: Used to implement a static page. It is compilable. For touch tenants a specific whiteCollar script, only for static sections, must be declared additionally.SUBSECTION
: deprecated It turns the menu item into a subsection that relates to a parent item. However, it is recommended to uselevel
instead. This page is compilable.
WARNING
When extracting partial sections in your local environment (e.g. mrf-def -p1 -q4
), section types such as Group and External can't be the first or only section targeted.
For example, executing mrf-def -p2 -q5
would fail on a tenant with these sections:
section 0 - home - default
section 1 - default
section 2 - group
section 3 - default - level 1
section 4 - default - level 1
section 5 - default - level 1
section 6 - default
However, mrf-def -p1 -q5
would work.
Example:
{
...,
"title":"Title of the awesome example site",
"uri":"www.example.com",
"sectionDefinitions":[{
"name":"section-name",
...
"type" : "GROUP",
...
}]
},
...
],
...
}
WARNING
Compiling static pages for touch tenants (not press): In order for a static section to be compiled, a specific whiteCollar script, only for static sections, must be declared, in addition to having "type": "STATIC"
.
Use the whiteCollarScript
property in the configuration of feedDefinitions
.
Example:
{
...,
"title": "Title of the awesome example site",
"uri": "www.example.com",
"sectionDefinitions": [{
"name": "section-name",
...,
"feedDefinitions": [{
"uri": "https://www.example.com/example",
"alibabaDefinition": {
"configuration": {
"whiteCollarScript": "../../marfeel/whiteCollar/static.js"
}
}
}],
"type" : "STATIC"
},
...
],
...
}
# whiteCollarScript
Establishes the path of the WhiteCollar file to be used by one specific section.
WARNING
Notice the flag is within the alibabaDefinition
's configuration of a section's feedDefinitions
.
Example:
{
...,
"title": "Title of the awesome example site",
"uri": "www.example.com",
"sectionDefinitions": [{
"name": "section-name",
...,
"feedDefinitions": [{
"uri": "https://www.example.com/example",
"alibabaDefinition": {
"configuration": {
"whiteCollarScript": "index/src/whiteCollar/example.js"
}
}
}],
},
...
],
...
}
:::
INFO
This flag can also be used to configure the default WhiteCollar file of the definition.json. Explained in detail here.