{%- from 'seo_schema_base.jinja' import render_seo -%} {%- if seo -%} {{- render_seo(seo, page_type | default("details"), breadcrumbs | default(none), list_breadcrumbs | default(none)) -}} {%- endif -%}
Menu
{%- from 'seo_schema_base.jinja' import render_seo -%} {%- if seo -%} {{- render_seo(seo, page_type | default("details"), breadcrumbs | default(none), list_breadcrumbs | default(none)) -}} {%- endif -%}

Jinja Synopsis: minimal example of jinja template

A Minimal Jinja Template

This is a simple template that demonstrates a few basic Jinja concepts: a loop, a variable, and a comment. This code is a complete, runnable example of how to start using Jinja's core features to create a dynamic web page.

text
<!DOCTYPE html>
<html lang="en" data-translate="true">
<head data-translate="true">
    <title data-translate="true">My Webpage</title>
</head>
<body data-translate="true">
    <ul id="navigation" data-translate="true">
    {% for item in navigation %}
        <li data-translate="true"><a href="{{ item.href }}" data-translate="true">{{ item.caption }}</a></li>
    {% endfor %}
    </ul>

    <h1 data-translate="true">My Webpage</h1>
    <p data-translate="true">{{ a_variable }}</p>

    {# This is a comment that will not be rendered #}
</body>
</html>

Explanation of Components

  • {% for ... %}:This is atagthat controls the flow of the template. Theforloop iterates over the `navigation` variable to generate a list of links.
  • {{ ... }}:These arevariablesthat are replaced with dynamic content when the template is rendered. In this example,item.href,item.caption, anda_variableare placeholders for data.
  • {# ... #}:This is acomment. Any text within these tags will be ignored by the Jinja engine and will not appear in the final HTML output.