Skip to content

Conversation

Ash-Crow
Copy link
Collaborator

@Ash-Crow Ash-Crow commented Oct 2, 2025

🎯 Objectif

Dans Django-DSFR, la balise <title> est à placer à l'intérieur du bloc {% title %}. Dans d’autres apps Django, par exemple jazzband/django-two-factor-auth, c'est le contraire, et cela pose des problèmes où le contenu de la variable {{ title }} se retrouve dans le header sans balise <title> autour.

🔍 Implémentation

  • Ajout d’un bloc externe {% title_wrapper %}

⚠️ Informations supplémentaires

Cela permet de redéfinir le bloc dans via un bloc intermédiaire sans que les noms de block entrent en conflit, par exemple :

{# templates/two_factor/_base.html #}
{% extends "dsfr/base.html" %}

{% block title_wrapper %}
  <title>
    {% block title %}
    {% endblock title %}
  </title>
{% endblock title_wrapper %}

… the inside of the title tag instead of the outside: allows to redefine it in an intermediary template
@Ash-Crow Ash-Crow merged commit 064db1a into main Oct 2, 2025
7 checks passed
@Ash-Crow Ash-Crow changed the title Résoud un problème d’incompatibilité avec la façon dont le bloc {% title %} est défini dans d’autres apps Résout un problème d’incompatibilité avec la façon dont le bloc {% title %} est défini dans d’autres apps Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant