The correct method for inheriting the <j> content Django template

I have a base.html template with sitewide tags for charset, google site check, style sheet, js .... I also need to configure blocks for special title tags and meta descriptions.

I am wondering if I should create {% block head%} in my base.html and in my inherited template template tags in this block, or do I need to configure certain blocks such as {% block meta%} and {% block title% } so that tags appear in appropriate places when Django displays html.

It makes sense? If I look at the source code with all the tags mixed in one {% block head%}, everything is a little out of order, but if I add certain blocks for each tag, they are fine, but use a lot more code ...?
+5
source share
1 answer

I usually have three blocks. These three have covered all my needs and my colleagues over the past 1.5 years :-)

  • Block for css.

  • Block for javascript.

  • A block called "head-extras". Often you want to do something special on page after page, for example, by adding a link element that points to your rss feed. Or some inline javascript snippet. With this block you clearly resolve these corner cases.

, , {{ super }} css javascript, "parent" .

, : -)

+5

All Articles