1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- {# ``base.html`` is the template all our other templates derive from. While
- Flask-Bootstrap ships with its own base, it is good form to create a custom
- one for our app, as it allows customizing some aspects.
- Deriving from bootstap/base.html gives us a basic page scaffoling.
- You can find additional information about template inheritance at
- http://jinja.pocoo.org/docs/templates/#template-inheritance
- #}
- {%- extends "bootstrap/base.html" %}
- {# We also set a default title, usually because we might forget to set one.
- In our sample app, we will most likely just opt not to change it #}
- {% block title %}Sample App for Flask-Bootstrap{% endblock %}
- {# While we are at it, we also enable fixes for legacy browsers. First we
- import the necessary macros: #}
- {% import "bootstrap/fixes.html" as fixes %}
- {# Then, inside the head block, we apply these. To not replace the header,
- ``super()`` is used: #}
- {% block head %}
- {{super()}}
- {#- Docs: http://pythonhosted.org/Flask-Bootstrap/macros.html#fixes
- The sample application already contains the required static files. #}
- {{fixes.ie8()}}
- {%- endblock %}
- {# Adding our own CSS files is also done here. Check the documentation at
- http://pythonhosted.org/Flask-Bootstrap/basic-usage.html#available-blocks
- for an overview. #}
- {% block styles -%}
- {{super()}} {# do not forget to call super or Bootstrap's own stylesheets
- will disappear! #}
- <link rel="stylesheet" type="text/css"
- href="{{url_for('static', filename='sample-app.css')}}">
- {% endblock %}
- {# Finally, round things out with navigation #}
- {% block navbar %}
- {{nav.frontend_top.render()}}
- {% endblock %}
|