Templates

Webcore provide some useful reusable generic templates. Most of them only needs to be styled with CSS, others are a good starting point to make your own.

HTML5boilerplate

For the moment this is the only base template available. This base template is a HTML5boilerplate template which contains (hopefully) all the necessary blocks to be extended.

First it’s important to understand the blocks name spacing. The three most important namespaces are site, project, app.

Here’s an hierarchical map of the block namespaces:

- site: generic stuff
    - project: project global stuff
        - app: application specific stuff

Extending base

The application templates should extend a base.html template that sits at project level. For portability convenience it should not extends the base.html provided by webcore directly.

For example, you project’s base.html could look like this:

{% extends "html5boilerplate/base.html" %}

{% block project.headstyles %}
<link rel="stylesheet" href="{{ STATIC_URL }}libs/960/css/960.css" />
<link rel="stylesheet" href="{{ STATIC_URL }}libs/960/css/text.css" />
{% endblock%}

{% block project.title %}webcore{% endblock %}

{% block project.head %}
<h1>Webcore</h1>
{% block app.head %}{% endblock %}
{% endblock %}

{% block project.body %}
<div class="{% block container.class %}container_12{% endblock %}">
    {# It's strongly suggested to use content as main content block #}
    {# since most reusable apps use this block. #}
    {% block content %}{% endblock %}
</div>

{% block project.footer %}
{% block app.footer %}{% endblock %}
<div id="footer">
    &copy; Copyright {% now "Y" %} Motion Média, all rights reserved.
</div>
{% endblock %}

{% endblock %}

Site blocks

The site blocks are top level blocks that usually wraps project and app blocks. Those block serves as “defaults” that can be extended.

Block Description
site.head Wraps the content of <head>
site.title Wraps the <title> element
site.meta Wraps the description, keywords, project & app metas
site.headstyles Wraps the project and app style blocks
site.headscripts Wraps the project and app script blocks
site.body Wraps the project head, body, footer blocks
site.styles Wraps the project and app style blocks
site.scripts Wraps the project and app script blocks. Also contains some other JS functionalities

Project blocks

The project blocks provide blocks that should be used at project level in django.

Block Description
project.title Project title are appended after app title
project.description Project’s description
project.keywords Project’s keywords
project.meta Project title are appended before app meta
project.favicon Wraps the favicon element
project.headstyles Block to add styles to the head of document
project.headscripts Block to add scripts to the head of document
project.head Project’s head
project.body Project’s body
project.footer Project’s footer

Other blocks

Some other blocks are provided for more edgy use cases

Block Description
doctype wraps the doctype, by default <!DOCTYPE html>
html.class You can add classes to the <html> tag with this
html.extra You can add attributes to the <html> tag with this