Newsletters
Newsletters are configured in the brand themes at config/nova/newsletter.json
Examples,
Structure
This JSON config contains two required top level properties,
newsletters- An object containing the newsletter configurations.default- The slug of the newsletter to be used by each<Newsletter />component by default.
The newsletters key contains an object, where each property is the slug of the newsletter, and an object with the name, description, and optional contexts array, which contains a mapping of newsletter locations.
{
"newsletters": {
"Awards_Season_Newsletter_Opted_In": {
"name": "Consider This Awards Roundup",
"description": "Curated e-mail digest of the best Awards coverage from the past 48-72 hrs."
},
"AnneThompson_Newsletter_Opted_In": {
"name": "Anne Thompson Emails",
"description": "Get the best coverage and industry news from IndieWire's Awards expert Anne Thompson."
},
"Breaking_News_Alerts_Opted_In": {
"name": "Breaking News",
"description": "Breaking News Alerts, when it happens, delivered throughout the day."
},
"Daily_Headlines_Alerts_Opted_In": {
"name": "Daily Headlines",
"description": "Daily Headlines covering Film, TV and more.",
"contexts": [
"article-footer"
]
}
},
"default": "Daily_Headlines_Alerts_Opted_In"
}Optional Properties
"Subscribe to All"
An optional property can be added to a brand's newsletter configuration if the brand would like certain signup forms to subscribe the visitor to all available newsletters.
In newsletter.json, add the optInAll key, setting its value to an object
containing to keys: name and description. The name is used as the heading
text for the <Newsletter /> component, while the description is used as the
tagline.
Consider this example from Artforum:
{
"newsletters": {
"Editorial_InPrint_Opted_In": {
"name": "In Print",
"description": "A monthly preview of highlights from the new issue."
},
"Editorial_Video_Opted_In": {
"name": "Video",
"description": "Featuring the latest episodes from Artforum’s video series."
},
"Editorial_EDU_Opted_In": {
"name": "ArtforumEDU",
"description": "ArtforumEDU delivers announcements from academic institutions and publishers—including calls for applications, employment opportunities, new publications, exhibitions, programs, and grants."
},
"Editorial_Events_Opted_In": {
"name": "Events",
"description": "Be the first to know about Artforum’s events and promotions."
}
},
"optInAll": {
"name": "Artforum Inbox",
"description": "Register to receive our full menu of newsletters—<em>The Archive</em>, <em>Must See</em>, <em>Video</em>, <em>In Print</em>, <em>Dispatch</em>, and <em>ArtforumEDU</em>—as well as special offers from <em>Artforum</em>."
},
"default": "Editorial_EDU_Opted_In"
}When the optInAll key is present, the newsletter widget automatically includes
an ALL (every configured newsletter) option.
In other uses of the <Newsletter /> component, set the model's newsletter_id
value to the KEY_OPT_IN_ALL constant available on the model:
$this->_add_nested_model_data(
'newsletter',
Components\Newsletter\Model::class,
[
'button_args' => [
'text' => __( 'Subscribe', 'pmc-nova' ),
],
'newsletter_id' => Components\Newsletter\Model::KEY_OPT_IN_ALL,
]
);