Default content — override me in a child template.
{% endblock %}Challenge 2: Build a Base Template + Two Child Pages — Possible Solution ====================================================================
Default content — override me in a child template.
{% endblock %}{{ book.description }}
← Back to all books {% endblock %} WHY THIS WORKS -------------- - {% extends "catalog/base.html" %} must be the very first line of each child template — Django's template engine requires it to appear before any other content, including whitespace-only lines with comments. - Both child templates override the SAME two named blocks (title and content) with different content each time — base.html never needs to know or care what any specific child page puts inside those blocks. - book_detail.html's title block interpolates {{ book.title }} directly inside the block override — blocks can contain normal template syntax, not just static text, so the page title becomes dynamic per book. - The default content inside base.html's {% block content %}...{% endblock %} (the "Default content" paragraph) would only ever actually render if a child template extended base.html WITHOUT overriding that block — useful as a fallback/placeholder during development. - The {% url 'book-list' %} link in book_detail.html reuses the named-URL pattern from Chapter 2 instead of hardcoding "/books/" directly.