Skip to content

Explain why the Web Debug Toolbar is gone #8934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 5, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,20 @@ to get your *new* lucky number!

http://localhost:8000/lucky/number

Now you may wonder where the Web Debug Toolbar has gone: that's because we don't write
a ``body`` element using the current template. If we incorporate the default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a body element -> a <body> HTML tag ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, though, strictly speaking, a tag is not an element, and I guess the element should be present, not only an opening tag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, only </body> have to be present. Not even a complete body element.

Strictly speaking there is a body element (The node in a DOM tree), which consists of an open and close tag.

In any case, let's be explict here and say "that's because there is no </body> tag in the current template. You can add the body element yourself, or extend base.html.twig, which contains all default HTML elements." (also removing first person usage)

If you agree, can you please update your PR (otherwise, just comment back)? Thanks!

``base.html.twig``, which contains all default elements, including ``body``, you'll see
that the Toolbar re-appears:

.. code-block:: diff

{# templates/lucky/number.html.twig #}
+ {% extends 'base.html.twig' %}

+ {% block body %}
<h1>Your lucky number is {{ number }}</h1>
+ {% endblock %}

In the :doc:`/templating` article, you'll learn all about Twig: how to loop, render
other templates and leverage its powerful layout inheritance system.

Expand Down