Toutes les collections
Newsletter
Variables
[Tutorial] Automatically add a padlock on a premium item
[Tutorial] Automatically add a padlock on a premium item

Automatically display a padlock (or other distinctive sign) when an item is reserved for subscribers.

Benjamin Carro avatar
Écrit par Benjamin Carro
Updated over a week ago

In this tutorial, we will see how it is possible to automatically display locks on items reserved for subscribers. In this way it will be possible for readers to differentiate between paid content and free articles.

To do this, we will use conditional variables. To learn more about how they work, I invite you to read this article that deals with the subject of conditional variables in newsletters.

Before we begin, let's point out that there is one prerequisite:

  • The "premium" information must be filled in the metadata of all articles and must be available in the feed.

How to differentiate premium items from free items?

We're going to add a conditional variable on all items that will display a lock when the item is paid for and won't display anything when the item is free.

Here, the metadata used to identify a paying item is "premium". So we will use {{#metadata.premium}} padlock image {{/metadata.premium}}.

  1. Add this variable where you want the padlock to appear. In this example, it will be in the title of item 1 and then at the beginning of the descriptions of items 2, 3 and 4.

2.  {{#metadata.premium}} add the padlock image here {{/metadata.premium}}

3. Adjust the size of the image by clicking on it.

4. Repeat the operation on all the articles of the newsletter otherwise the conditional variable will not be active on all the contents.

After adding the conditional variable on all the articles, we see that it works correctly, since articles 1 and 4 display the padlock. This is only a preview. To manage the editorialization of the contents, you have to go to the "Editorial" tab.

Good to know:
For images, use the following formats: .jpg or .png :

  • .jpg : compressed format with white background

  • .png : compressed format allowing transparency

For this example, I chose to use an image, but it could be text e.g. {{#metadata.premium}} Reserved for subscribers {{/metadata.premium}}.

Avez-vous trouvé la réponse à votre question ?