[Fixed]-Django child template not including content in template tags from base.html

1👍

In your about.html template you need to add

{% block content %}
    <!-- Add your about content here -->
{% endblock content %}

You also don’t need <html>, <head> or <body> tags in the about.html file as they are in the base.html file already

👤drew

0👍

I think you want you about.html to look like this.

{% extends "base.html" %}
{% load staticfiles %} 
{% block title %}About{% endblock %}
{% block content %}Hi,About!{% endblock %}

Note: You have an <h1> in your header and I think you actually want that in your <body>

👤HenryM

0👍

When you extend base.html your base.html defines entire html page. In your about.html you just need to code what you want to insert in base.html blocks. So, your about.html have to like this

{% extends "base.html" %}
{% load staticfiles %} 
{% block title %}
   About
{% endblock %}
{% block h1 %}
   Hi,About!
{% endblock %}

Leave a comment