Logo
  • Blog-fr
  • Blog-en
Login

How to make a Smart Message

Pour créer un Smart Message et pouvoir l’utiliser dans les bots (smart message) et dans les posts (icône ampoule), il vous suffit de vous rendre dans la marque et de créer le template que vous souhaitez créer

Exemple générique

Exemple pour afficher le titre et le lien en dessous, sur les Twitter Cards (type lien)

{%- if social_network =='twitter' and post_type == 'link' -%}
	{{- title ?? ai_generated -}}
	{{- '\n' -}}
	➡️ [SHORTLINK]
{%- elseif post_type == 'photo'  -%}
	{{- ai_generated -}}
	{{- '\n' -}}
	➡️ [SHORTLINK]
{%- else  -%}
	{{- ai_generated -}}
{%- endif -%}

Exemple pour mentionner automatiquement les auteurs sur Twitter

Exemple pour mentionner automatiquement les auteurs sur Twitter grâce à Airtable

Exemple pour générer automatiquement des hashtags sur Twitter grâce à la microdata “keywords” de l’article

{%- if social_network == 'twitter' and post_type == 'link' -%}
{{- title ~ '\n' -}}
➡️ [SHORTLINK]
{{- '\n' -}}
	{%- for tag in tags|slice(0, 10) -%}
		{{- loop.index > 1 ? ' #' : '#' -}}{{- tag|ucPhrase|replace({' ': ''}) -}}
	{%- endfor -%}
{%- else -%}
	{{- ai_generated -}}
{%- endif -%}

Utilisation de la fonction aiGenerated

aiGenerated(messageVar, charCountMin, charCountTarget, charCountMax, etcChars, justCrop)
  • messageVar : chaîne de caractères, variable à utiliser dans le résumé intelligent (facultatif, par défaut utilisation de la description pour les posts de type lien et du titre pour les autres types de posts).
  • charCountMin : nombre entier, nombre minimum de caractères dans le résumé intelligent (facultatif, valeur par défaut 25)
  • charCountTarget : nombre entier, nombre cible de caractères dans le résumé intelligent (facultatif, valeur par défaut 60)
  • charCountMax : nombre entier, nombre maximum de caractères dans le résumé intelligent (facultatif, valeur par défaut 230)
  • etcChars : chaîne de caractères ou tableau de chaînes de caractères pouvant être utilisées en suffixe du résumé ; si plusieurs chaînes sont transmises, un est choisie aléatoirement (facultatif, valeur par défaut [“👇”, “ ⬇️”, “ ⤵️”, “…”])
  • justCrop : booléen indiquant l’utilisation du cropper uniquement (non utilisation du résumé intelligent) (facultatif, false par défaut)

Exemple :

{% set etcChars={
	0: ', etc.', 
  1: '...', 
  2: '⬇️'
} %}
{{ aiGenerated('description', 25, 50, 60, etcChars) }}

Utiliser la description et mettre des sauts de ligne automatiquement

Exemple de smart template avec la fonction aiGenerated()

{%- if social_network =='facebook' and post_type == 'photo' -%}
	{{- aiGenerated('description', 25, 100, 300) -}}
	{{- '\n' -}}
	{{ shortlink_prefix }} [SHORTLINK]
{%- elseif social_network =='facebook' and post_type == 'link' -%}
	{{- aiGenerated('description', 25, 60, 300) -}}
{%- else  -%}
	{{- ai_generated -}}
{%- endif -%}

Chapô complet dans le message pour Facebook de type lien

Extraire une citation du titre

Exemple de titre : « Ils vident leurs chargeurs sur un homme heureux » : les révélations de l’enquête sur la mort d’Aramburu

Nous souhaitons extraire la citation entre « et »

{%- set citation = title | extractMatch('/(«\\\s.+\\\s»)/u') %}
{{- citation ?: title -}}

Dans ce cas nous souhaitons extraire la fin du titre après les :

{{- title | extractMatch('/«\\\s.+\\\s»\\\s:\\\s(.+)/u') | capitalize ?: title -}}

Ajout d’un premier commentaire avec un lien raccourci

Uniquement pour les posts facebook de type photo

{%- if social_network == 'facebook' and post_type == 'photo' -%}
Plus d'infos ici ➡️ [SHORTLINK]
{%- endif -%}

Pour les posts facebook et linkedin de type photo nous ajoutons des commentaires sur 50% des posts

Message si premier commentaire avec shortlink présent

Utiliser ChatGPT d’OpenAI pour générer un message

💡
Pour utiliser Open AI vous devez ajouter une clé d’API dans Nonli en passant par le menu burger → Mon entreprise → Section “OpenAI”

Exemple de fonction pour tous les types de posts avec le modèle GPT 4o

Ajout du shortlink dans certains contexte avec le modèle GPT 4o

Créer un visuel avec l’éphéméride

Écrire le prénom

{%- set prompt = 'Écris uniquement un prénom dont c\'est la fête aujourd\'hui, sans introduction' -%}
{{- gpt(prompt, 'gpt-4o-mini') -}}

Générer le message d’accroche

{%- set prompt = 'Génère un message d'accroche court et joyeux pour souhaiter une bonne fête dans le cadre d'une éphéméride. Exemple : "Passe une agréable journée 🥳"' -%}
{{- gpt(prompt, 'gpt-4o-mini') -}}

La Une d’un journal

To create a Smart Message and be able to use it in bots (smart message) and in posts (light bulb icon), you simply need to go to the brand and create the template you wish to create

Generic example

Example to display the title and link below, on Twitter Cards (link type)

{%- if social_network =='twitter' and post_type == 'link' -%}
	{{- title ?? ai_generated -}}
	{{- '\n' -}}
	➡️ [SHORTLINK]
{%- elseif post_type == 'photo'  -%}
	{{- ai_generated -}}
	{{- '\n' -}}
	➡️ [SHORTLINK]
{%- else  -%}
	{{- ai_generated -}}
{%- endif -%}

Example to automatically mention authors on Twitter

Example to automatically mention authors on Twitter using Airtable

Example to automatically generate hashtags on Twitter using the article's "keywords" microdata

{%- if social_network == 'twitter' and post_type == 'link' -%}
{{- title ~ '\n' -}}
➡️ [SHORTLINK]
{{- '\n' -}}
	{%- for tag in tags|slice(0, 10) -%}
		{{- loop.index > 1 ? ' #' : '#' -}}{{- tag|ucPhrase|replace({' ': ''}) -}}
	{%- endfor -%}
{%- else -%}
	{{- ai_generated -}}
{%- endif -%}

Using the aiGenerated function

aiGenerated(messageVar, charCountMin, charCountTarget, charCountMax, etcChars, justCrop)
  • messageVar: string, variable to use in the smart summary (optional, by default uses description for link-type posts and title for other post types).
  • charCountMin: integer, minimum number of characters in the smart summary (optional, default value 25)
  • charCountTarget: integer, target number of characters in the smart summary (optional, default value 60)
  • charCountMax: integer, maximum number of characters in the smart summary (optional, default value 230)
  • etcChars: string or array of strings that can be used as a suffix for the summary; if multiple strings are passed, one is chosen randomly (optional, default value ["👇", " ⬇️", " ⤵️", "…"])
  • justCrop: boolean indicating the use of the cropper only (not using smart summary) (optional, false by default)

Example:

{% set etcChars={
	0: ', etc.', 
  1: '...', 
  2: '⬇️'
} %}
{{ aiGenerated('description', 25, 50, 60, etcChars) }}

Use the description and automatically add line breaks

Example of smart template with the aiGenerated() function

{%- if social_network =='facebook' and post_type == 'photo' -%}
	{{- aiGenerated('description', 25, 100, 300) -}}
	{{- '\n' -}}
	{{ shortlink_prefix }} [SHORTLINK]
{%- elseif social_network =='facebook' and post_type == 'link' -%}
	{{- aiGenerated('description', 25, 60, 300) -}}
{%- else  -%}
	{{- ai_generated -}}
{%- endif -%}

Full lead in the message for Facebook link-type

Add a first comment with a shortened link

Only for facebook posts of type photo

{%- if social_network == 'facebook' and post_type == 'photo' -%}
More info here ➡️ [SHORTLINK]
{%- endif -%}

For facebook and linkedin posts of type photo we add comments on 50% of posts

Message if first comment with shortlink present

Use ChatGPT from OpenAI to generate a message

To use Open AI you need to add an API key in Nonli by going through the burger menu → My company → "OpenAI" section

Example function for all post types with the GPT 4o model

Add shortlink in certain contexts with the GPT 4o model

Using GPT-4o-mini to generate a message

Create a sober message on sensitive topics

Rewrite a title to display on an image

For facebook and linkedin posts of type photo we add comments on 50% of posts that are generated by GPT-4o-mini

Logo

Terms-en

CGU-fr

Cookies-en

Cookies-fr

RGPD-fr

GDPR-en

Confidentialité-fr

Privacy-en

FAQ-en

FAQ-fr

© Nonli - Not Only Link

{%- if social_network =='facebook' and post_type == 'link' -%}
	{{- meta_custom_facebook ?? ai_generated -}} 
{%- elseif social_network =='linkedin' and post_type == 'link' -%}
	{{- meta_custom_facebook ?? title ~ "\n\n" ~ description -}} 
{%- elseif social_network =='twitter' and post_type == 'photo' -%}
	{{- title }} 

	{{ description -}} 
{%- else -%}
	{{- ai_generated -}}
{%- endif -%} 
{%- set twitterAccounts = {
    'Fabrice Arfi' : '@fabricearfi',
    'Antton Rouget': '@AnttonRouget',
    'Joseph Confavreux': '@JoConfa'
} -%}
{%- if social_network =='twitter' and post_type == 'link' -%}
	{{- title ?? ai_generated -}}
	{%- for authorName in authors -%}
		{%- if twitterAccounts[authorName] -%}
			{{- loop.index == 1 ? '\nPar ' : ' ' -}}
			{{- twitterAccounts[authorName] -}}
		{%- endif -%}
	{%- endfor -%}
	{{- '\n\n' -}}
	➡️ [SHORTLINK]
{%- else -%}
	{{- ai_generated -}}
{%- endif -%}
{%- if social_network =='twitter' and post_type == 'link' -%}
	{{- title ?? ai_generated -}}
    {%- set isFirstAuthorMentioned = false -%}
    {%- for authorName in authors -%}
        {%- set mention = airtable('BDD ID', 'Nom de la table', 'Nom du champs que l\'on envoie (Auteur)', authorName, 'Nom du champs à retourner (mention Twitter)') -%}
        {%- if mention -%}
            {%- if not isFirstAuthorMentioned -%}
                {{- '\nPar ' -}}
                {%- set isFirstAuthorMentioned = true -%}
            {%- else -%}
                {{- ' ' -}}
            {%- endif -%}
            {{- mention -}}
        {%- endif -%}
    {%- endfor -%}
	{{- '\n\n' -}}
	➡️ [SHORTLINK]
{%- else -%}
	{{- ai_generated -}}
{%- endif -%}
{%- set max_characters = 2000 -%}
{%- if social_network == 'twitter' -%}
    {%- set max_characters = 200 -%}
{%- elseif social_network == 'threads' -%}
    {%- set max_characters = 400 -%}
{%- endif -%}
{%- set shortlink = '' -%}
{%- if social_network not in ['instagram', 'tiktok'] and post_type != 'link' -%}
    {%- set shortlink = shortlink_prefix ~ '[SHORTLINK]' -%}
{%- endif -%}
{%- set description = description | replace({'...': '…'}) -%}
{%- set description = description | replace({
    '. ': '. [BREAK]', 
    '? ': '? [BREAK]', 
    '! ': '! [BREAK]',
    '… ': '… [BREAK]'
}) -%}
{%- set description_parts = description | split('[BREAK]') -%}
{%- set formatted_description = '' -%}
{%- for part in description_parts -%}
    {%- set part = part | trim -%}
    {%- if not loop.last and part | last in ['.', '?', '!', '…'] and description_parts[loop.index0 + 1] | first matches '/^[A-Z]/' -%}
        {%- set formatted_description = formatted_description ~ part ~ "\n\n" -%}
    {%- else -%}
        {%- set formatted_description = formatted_description ~ part ~ ' ' -%}
    {%- endif -%}
{%- endfor -%}
{{ aiGenerated(formatted_description | trim, 5, max_characters, max_characters, "(…)", 1) }}{{ shortlink -}}
{%- if title is not empty -%}
  {%- if (social_network == 'facebook' or social_network == 'linkedin') and post_type == 'link' -%}
    {{- description -}}
  {%- elseif social_network == 'instagram' -%}
    {{- title -}}
    {{- '\n' -}}
    {{- description -}}
  {%- elseif social_network == 'tiktok' -%}
    {{- title -}}
  {%- elseif social_network == 'twitter' and post_type == 'link' -%}
    {{- title -}}
  {%- else -%}
    {{- title -}}
    {{- shortlink_prefix }} [SHORTLINK]
  {%- endif -%}
{%- endif -%}
{%- if (social_network == 'facebook' or social_network == 'linkedin') and post_type == 'photo' -%}
    {%- set percentage = 50 -%}
    {%- if random(0, 100) < percentage -%}
        Plus d'infos ici ➡️ [SHORTLINK]
    {%- endif -%}
{%- elseif social_network == 'instagram' -%}
    Plus d\'infos dans le lien en bio {{ post.social_account.slug -}}

{{ '\n' -}}
	{%- for tag in tags|slice(0, 10) -%}
		{{- loop.index > 1 ? ' #' : '#' -}}{{- tag|ucPhrase|replace({' ': ''}) -}}
	{%- endfor -%}
{%- endif -%}
{%- set needDescriptionFirst = post_type == 'link' -%}

{%- if needDescriptionFirst == true -%}
    {% set message = description ?? title %}
{%- else -%}
    {% set message = title %}
{%- endif -%}

{%- set justCrop = post_type != 'link' -%}

{{- aiGenerated(message, 25, 60, 230, null, justCrop) -}}

{%- if
    message is not empty
    and (
        (
            social_network != 'instagram'
            and social_network != 'facebook'
            and social_network != 'tiktok'
            and post_type is not empty
            and post_type != 'link'
        ) or social_network == 'twitter'
    )
-%}
    {{ shortlink_prefix }}[SHORTLINK]
{%- endif -%}
{{- gpt('Tu es community manager expert en teasing sur ' ~ social_network ~ ' dans la presse d\'information. Maîtrisant les émojis et les tendances utilisateurs, tu crées des teasers de moins de ' ~ max_characters ~ ' caractères, optimisés pour l\'algorithme, sans hashtags et avec un seul emoji. Tes teasers surprennent, apportent une info complémentaire au titre, et s\'adaptent au sujet avec un style journalistique. Pour cet article :

Titre : ' ~ title ~ '
Description : ' ~ description ~ '

Génère uniquement un teaser pour ' ~ social_network ~ ' de moins de ' ~ max_characters ~ ' caractères, sans entourer le résultat par des doubles quotes, sans ajout d'autre contenu.', 'gpt-4o') -}}
{%- set max_characters = 150 -%}
{%- set shortlink = '' -%}
{%- if social_network not in ['instagram', 'tiktok'] and post_type != 'link' and not hasFirstCommentShortlink() -%}
    {%- set shortlink = shortlink_prefix ~ '[SHORTLINK]' -%}
    {%- set max_characters = 60 -%}
{%- endif -%}

{%- set prompt = 
    'Tu es community manager expert en teasing sur ' ~ social_network ~ ' dans la presse d\'information. Maîtrisant les émojis et les tendances utilisateurs, tu crées des teasers de moins de ' ~ max_characters ~ ' caractères, optimisés pour l\'algorithme, sans hashtags et avec un seul emoji. Tes teasers surprennent, apportent une info complémentaire au titre, et s\'adaptent au sujet avec un style journalistique. Pour cet article :

Titre : ' ~ title ~ '
Description : ' ~ description ~ '

Génère uniquement un teaser pour ' ~ social_network ~ ' de moins de ' ~ max_characters ~ ' caractères, sans entourer le résultat par des doubles quotes, sans ajout d\'autre contenu.'
-%}

{{- gpt(prompt, 'gpt-4o') -}}{{ shortlink -}}
{%- set dayOfWeek = "now"|date("N") -%}
{%- set dayNames = ['lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche'] -%}
{%- set dayName = dayNames[dayOfWeek|number_format - 1] -%}
{%- if dayOfWeek == "6" or dayOfWeek == "7" -%}
    🗞️ Voici la une du journal «Le Temps» de ce week-end.
{%- else -%}
    🗞️ Voici la une du journal «Le Temps» de ce {{ dayName }}.
{%- endif -%}
{%- if social_network =='facebook' and post_type == 'link' -%}
	{{- meta_custom_facebook ?? ai_generated -}} 
{%- elseif social_network =='linkedin' and post_type == 'link' -%}
	{{- meta_custom_facebook ?? title ~ "\n\n" ~ description -}} 
{%- elseif social_network =='twitter' and post_type == 'photo' -%}
	{{- title }} 

	{{ description -}} 
{%- else -%}
	{{- ai_generated -}}
{%- endif -%} 
{%- set twitterAccounts = {
    'Fabrice Arfi' : '@fabricearfi',
    'Antton Rouget': '@AnttonRouget',
    'Joseph Confavreux': '@JoConfa'
} -%}
{%- if social_network =='twitter' and post_type == 'link' -%}
	{{- title ?? ai_generated -}}
	{%- for authorName in authors -%}
		{%- if twitterAccounts[authorName] -%}
			{{- loop.index == 1 ? '\nBy ' : ' ' -}}
			{{- twitterAccounts[authorName] -}}
		{%- endif -%}
	{%- endfor -%}
	{{- '\n\n' -}}
	➡️ [SHORTLINK]
{%- else -%}
	{{- ai_generated -}}
{%- endif -%}
{%- if social_network =='twitter' and post_type == 'link' -%}
	{{- title ?? ai_generated -}}
    {%- set isFirstAuthorMentioned = false -%}
    {%- for authorName in authors -%}
        {%- set mention = airtable('BDD ID', 'Table name', 'Name of the field we send (Author)', authorName, 'Name of the field to return (Twitter mention)') -%}
        {%- if mention -%}
            {%- if not isFirstAuthorMentioned -%}
                {{- '\nBy ' -}}
                {%- set isFirstAuthorMentioned = true -%}
            {%- else -%}
                {{- ' ' -}}
            {%- endif -%}
            {{- mention -}}
        {%- endif -%}
    {%- endfor -%}
	{{- '\n\n' -}}
	➡️ [SHORTLINK]
{%- else -%}
	{{- ai_generated -}}
{%- endif -%}
{%- set max_characters = 2000 -%}
{%- if social_network == 'twitter' -%}
    {%- set max_characters = 200 -%}
{%- elseif social_network == 'threads' -%}
    {%- set max_characters = 400 -%}
{%- endif -%}
{%- set shortlink = '' -%}
{%- if social_network not in ['instagram', 'tiktok'] and post_type != 'link' -%}
    {%- set shortlink = shortlink_prefix ~ '[SHORTLINK]' -%}
{%- endif -%}
{%- set description = description | replace({'...': '…'}) -%}
{%- set description = description | replace({
    '. ': '. [BREAK]', 
    '? ': '? [BREAK]', 
    '! ': '! [BREAK]',
    '… ': '… [BREAK]'
}) -%}
{%- set description_parts = description | split('[BREAK]') -%}
{%- set formatted_description = '' -%}
{%- for part in description_parts -%}
    {%- set part = part | trim -%}
    {%- if not loop.last and part | last in ['.', '?', '!', '…'] and description_parts[loop.index0 + 1] | first matches '/^[A-Z]/' -%}
        {%- set formatted_description = formatted_description ~ part ~ "\n\n" -%}
    {%- else -%}
        {%- set formatted_description = formatted_description ~ part ~ ' ' -%}
    {%- endif -%}
{%- endfor -%}
{{ aiGenerated(formatted_description | trim, 5, max_characters, max_characters, "(…)", 1) }}{{ shortlink -}}
{%- if title is not empty -%}
  {%- if (social_network == 'facebook' or social_network == 'linkedin') and post_type == 'link' -%}
    {{- description -}}
  {%- elseif social_network == 'instagram' -%}
    {{- title -}}
    {{- '\n' -}}
    {{- description -}}
  {%- elseif social_network == 'tiktok' -%}
    {{- title -}}
  {%- elseif social_network == 'twitter' and post_type == 'link' -%}
    {{- title -}}
  {%- else -%}
    {{- title -}}
    {{- shortlink_prefix }} [SHORTLINK]
  {%- endif -%}
{%- endif -%}
{%- if (social_network == 'facebook' or social_network == 'linkedin') and post_type == 'photo' -%}
    {%- set percentage = 50 -%}
    {%- if random(0, 100) < percentage -%}
        [SHORTLINK]
    {%- endif -%}
{%- elseif social_network == 'instagram' -%}
    More info in the link in bio {{ post.social_account.slug -}}

{{ '\n' -}}
	{%- for tag in tags|slice(0, 10) -%}
		{{- loop.index > 1 ? ' #' : '#' -}}{{- tag|ucPhrase|replace({' ': ''}) -}}
	{%- endfor -%}
{%- endif -%}
{%- set needDescriptionFirst = post_type == 'link' -%}

{%- if needDescriptionFirst == true -%}
    {% set message = description ?? title %}
{%- else -%}
    {% set message = title %}
{%- endif -%}

{%- set justCrop = post_type != 'link' -%}

{{- aiGenerated(message, 25, 60, 230, null, justCrop) -}}

{%- if
    message is not empty
    and (
        (
            social_network != 'instagram'
            and social_network != 'facebook'
            and social_network != 'tiktok'
            and post_type is not empty
            and post_type != 'link'
        ) or social_network == 'twitter'
    )
-%}
    {{ shortlink_prefix }}[SHORTLINK]
{%- endif -%}
{{- gpt('You are an expert community manager in teasing on ' ~ social_network ~ ' in the news press. Mastering emojis and user trends, you create teasers of less than ' ~ max_characters ~ ' characters, optimized for the algorithm, without hashtags and with a single emoji. Your teasers surprise, provide additional information to the title, and adapt to the subject with a journalistic style. For this article:

Title: ' ~ title ~ '
Description: ' ~ description ~ '

Generate only a teaser for ' ~ social_network ~ ' of less than ' ~ max_characters ~ ' characters, without surrounding the result with double quotes, without adding other content.', 'gpt-4o') -}}
{%- set max_characters = 150 -%}
{%- set shortlink = '' -%}
{%- if social_network not in ['instagram', 'tiktok'] and post_type != 'link' and not hasFirstCommentShortlink() -%}
    {%- set shortlink = shortlink_prefix ~ '[SHORTLINK]' -%}
    {%- set max_characters = 60 -%}
{%- endif -%}

{%- set prompt = 
    'You are an expert community manager in teasing on ' ~ social_network ~ ' in the news press. Mastering emojis and user trends, you create teasers of less than ' ~ max_characters ~ ' characters, optimized for the algorithm, without hashtags and with a single emoji. Your teasers surprise, provide additional information to the title, and adapt to the subject with a journalistic style. For this article:

Title: ' ~ title ~ '
Description: ' ~ description ~ '

Generate only a teaser for ' ~ social_network ~ ' of less than ' ~ max_characters ~ ' characters, without surrounding the result with double quotes, without adding other content.'
-%}

{{- gpt(prompt, 'gpt-4o') -}}{{ shortlink -}}<h2
{%- set max_characters = 150 -%}
{%- set shortlink = '' -%}
{%- if social_network not in ['instagram', 'tiktok'] and post_type != 'link' and not hasFirstCommentShortlink() -%}
    {%- set shortlink = shortlink_prefix ~ '[SHORTLINK]' -%}
    {%- set max_characters = 60 -%}
{%- endif -%}

{%- set prompt = 
    'For this article:

Title: ' ~ title ~ '
Description: ' ~ description ~ '

Generate only a teaser of less than ' ~ max_characters ~ ' characters, with a single emoji, without adding any other content.'
-%}

{{- gpt(prompt, 'gpt-4o-mini') -}}{{ shortlink -}}
{%- set max_characters = 150 -%}
{%- set shortlink = '' -%}
{%- if social_network not in ['instagram', 'tiktok'] and post_type != 'link' and not hasFirstCommentShortlink() -%}
  {%- set shortlink = shortlink_prefix ~ '[SHORTLINK]' -%}
{%- endif -%}

{%- set prompt = 
    'You are an expert community manager in wording on ' ~ social_network ~ ' for news media. ' ~
    'Mastering emojis and user trends, you create teasers of less than ' ~ max_characters ~ ' characters, optimized for the algorithm, without hashtags or calls to action. ' ~
    'Written in relevant, clear, and simple English based on the ' ~ title ~ ' and ' ~ description ~ ', your teasers should engage and intrigue, without revealing the main information. ' ~
    'Adapt the tone of your wording to the article\'s subject: if it\'s light, you can use emojis and adopt a friendly tone. ' ~
    'If the subject is serious or negative (for example: trials, rapes, disappearances, scandals, deaths, accidents, crimes), never use emojis and adopt a sober and respectful tone. ' ~
    'Do not use words that incite direct action such as "discover", "click", "read", or any other call to action. ' ~
    'For this article:

    Title: ' ~ title ~ '
    Description: ' ~ description ~ '

    Generate only a teaser for ' ~ social_network ~ ' of less than ' ~ max_characters ~ ' characters, without surrounding the result with double quotes, without adding other content. It should not be apparent that you wrote the teaser.'
-%}

{{- gpt(prompt, 'gpt-4o-mini') }}{{ shortlink -}}
{%- set min_characters = 60 -%}
{%- set max_characters = 80 -%}
{%- set shortlink = '' -%}

{%- set prompt = 'Generate a suitable title for this article with the following title: "' ~ title ~ '" and description: "' ~ description ~ '". The title should contain between ' ~ min_characters ~ ' and ' ~ max_characters ~ ' characters. Do not add emojis or hashtags. Give only the final text, without surrounding the result with double quotes.' -%}

{{- gpt(prompt, 'gpt-4o-mini') -}}
{%- if (social_network == 'facebook' or social_network == 'linkedin') and post_type == 'photo' -%}
    {%- set percentage = 50 -%}
    {%- if random(0, 100) < percentage -%}
    {%- set prompt = 
    'For this article:

Title: ' ~ title ~ '
Description: ' ~ description ~ '

Generate a call to action of less than 100 characters without hashtags with an emoji at the end that will be placed just before the link to the article'
-%}

{{- gpt(prompt, 'gpt-4o-mini') }} [SHORTLINK]
    {%- endif -%}
{%- elseif social_network == 'instagram' -%}
    More info in the link in bio {{ post.social_account.slug -}}

{{ '\n' -}}
	{%- for tag in tags|slice(0, 10) -%}
		{{- loop.index > 1 ? ' #' : '#' -}}{{- tag|ucPhrase|replace({' ': ''}) -}}
	{%- endfor -%}
{%- endif -%}