Skip to main content

Drafting templates with conditions!

Nestor uses a programming language to generate text in messages. You can harness this and use branching conditions in your templates: https://twig.symfony.com/doc/2.x/tags/index.html. The configuration is a bit technical, but will result in:

  • modulable texts
  • cleaner interfaces
  • less technical support

The description below gives one typical example, but the possibilities are endless.



E-mail conditions: a case study

Let us consider the case of the acceptance letter, where we want to:

  • use some general text to inform the author that the article is accepted
  • IF certain conditions are met, modify a few parts of the text

For this purpose, we could create two different templates:

Template for a "regular article"
Template for a "note to the editor"

Dear author,


Congratulations on being accepted! We have received all source files and your paper is now in the hands of the copy editor.


You will receive the galley proofs in about two weeks.


Best regards,

The Editorial Office

Dear author,


Congratulations on being accepted! We have received all source files and your note to the editor is about to be published!


You will receive the galley proofs by tomorrow.


Best regards,

The Editorial Office

This presents the following downsides:

  • now we have two similar templates to maintain
  • this clutters the editor interface:

image.png



Instead, let us create one single template, inserting cool conditions when needed:

Global template

Dear author,


Congratulations on being accepted! We have received all source files and your {% if article.articleType.code == 'REGULAR' %}paper is now in the hands of the copy editor{% else %}note to the editor is about to be published!{% endif %}.


You will receive the galley proofs in about {% if article.articleType.code == 'REGULAR' %}two weeks{% else %}by tomorrow{% endif %}.


Best regards,
The Editorial Office

This results in a single template to maintain, and a cleaner editor interface:

image.png