Can't add to head in Django Template

51 Views Asked by At

I have the following:

bootstrap.html:

{% extends 'django_bootstrap5/bootstrap5.html' %} 
{% block bootstrap5_title %}{% block title %}{% endblock %}{% endblock %}

sm/base.html:

{% extends 'sm/bootstrap.html' %}

{% load django_bootstrap5 %}

{% block head %}
 <meta name="robots" content="all, index, follow" />
{% endblock %}

{% block bootstrap5_content %}
    <div class="container">
        <h1>{% block title %}(no title){% endblock %}</h1>
        {% autoescape off %}{% bootstrap_messages %}{% endautoescape %}
        {% block content %}(no content){% endblock %}
    </div>

{% endblock %}

sm/home.html:

{% extends 'sm/base.html' %}
{% load django_bootstrap5 %}


{% block title %}My title{% endblock %}

{% block head %}
 <meta name="robots" content="all, index, follow" />
{% endblock %}

{% block content %}
    <br/>
    
{% endblock %}

When I view the output, I don't see the robot meta in the head. What am I doing wrong?

<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en-ie">
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<title>My title</title>

<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" rel="stylesheet">

</head>
<body> ...
0

There are 0 best solutions below