My header.html
is included in my base.html
which is extended in all template pages.
header.html
{% block header %}
{% load static %}
{% load is_current %}
<!DOCTYPE html>
<html class="no-js" lang="fr">
<head>
<!--- basic page needs
================================================== -->
<meta charset="utf-8">
{% block title %}
<title></title>
{% endblock %}
</head>
<body id="top">
<!-- header
================================================== -->
<header class="s-header header">
<!-- header_content -->
</header>
{% endblock header %}
base.html
{% load static %}
{% block header %}
{% include 'header.html' %}
{% endblock header %}
{% block content %}
{% endblock %}
{% block footer %}
{% include 'footer.html' %}
{% endblock footer %}
For the header, I’ve tried multiple ways to load dynamic titles for each page.
This:
{% block title %}
<title></title>
{% endblock %}
Or this:
<title>
{% block title %}
{% endblock %}
</title>
If I add a value to the title in header.html
, it’s taken into account and it overrides all the title of inherited templates.
Example of inherited template:
{% extends 'base.html'%}
{% block title %} Some title {% endblock %}
{% load static %}
{% block content %}
<!-- some-content -->
{% endblock %}
Thanks for your help!