Removed blocks in partials - Jinja doesn't support them

This commit is contained in:
squidfunk 2019-02-09 18:02:46 +01:00
parent 9d46c27a9e
commit a27372eee3
7 changed files with 53 additions and 73 deletions

View File

@ -155,14 +155,10 @@ The Material theme provides the following template blocks:
| `hero` | Wraps the hero teaser | | `hero` | Wraps the hero teaser |
| `htmltitle` | Wraps the `<title>` tag | | `htmltitle` | Wraps the `<title>` tag |
| `libs` | Wraps the JavaScript libraries, e.g. Modernizr | | `libs` | Wraps the JavaScript libraries, e.g. Modernizr |
| `repo` | Wraps the repository link in the header bar |
| `scripts` | Wraps the JavaScript application logic | | `scripts` | Wraps the JavaScript application logic |
| `source` | Wraps the linked source files | | `source` | Wraps the linked source files |
| `search_box` | Wraps the search form in the header bar |
| `site_meta` | Wraps the meta tags in the document head | | `site_meta` | Wraps the meta tags in the document head |
| `site_name` | Wraps the site name in the header bar |
| `site_nav` | Wraps the site navigation and table of contents | | `site_nav` | Wraps the site navigation and table of contents |
| `social` | Wraps the social links in the footer |
| `styles` | Wraps the stylesheets (also extra sources) | | `styles` | Wraps the stylesheets (also extra sources) |
For more on this topic refer to the [MkDocs documentation][4] For more on this topic refer to the [MkDocs documentation][4]

View File

@ -50,9 +50,7 @@
<a href="https://squidfunk.github.io/mkdocs-material/"> <a href="https://squidfunk.github.io/mkdocs-material/">
Material for MkDocs</a> Material for MkDocs</a>
</div> </div>
{% block social %} {% include "partials/social.html" %}
{% include "partials/social.html" %}
{% endblock %}
</div> </div>
</div> </div>
</footer> </footer>

View File

@ -15,27 +15,23 @@
</div> </div>
<div class="md-flex__cell md-flex__cell--stretch"> <div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title"> <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
{% block site_name %} {% if config.site_name == page.title %}
{% if config.site_name == page.title %} {{ config.site_name }}
{% else %}
<span class="md-header-nav__topic">
{{ config.site_name }} {{ config.site_name }}
{% else %} </span>
<span class="md-header-nav__topic"> <span class="md-header-nav__topic">
{{ config.site_name }} {{ page.title }}
</span> </span>
<span class="md-header-nav__topic"> {% endif %}
{{ page.title }}
</span>
{% endif %}
{% endblock %}
</div> </div>
</div> </div>
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
{% block search_box %} {% if "search" in config["plugins"] %}
{% if "search" in config["plugins"] %} <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label> {% include "partials/search.html" %}
{% include "partials/search.html" %} {% endif %}
{% endif %}
{% endblock %}
</div> </div>
{% if config.repo_url %} {% if config.repo_url %}
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">

View File

@ -9,17 +9,15 @@
{% else %} {% else %}
{% set repo_type = "" %} {% set repo_type = "" %}
{% endif %} {% endif %}
{% block repo %} <a href="{{ config.repo_url }}" title="{{ lang.t('source.link.title') }}" class="md-source" data-md-source="{{ repo_type }}">
<a href="{{ config.repo_url }}" title="{{ lang.t('source.link.title') }}" class="md-source" data-md-source="{{ repo_type }}"> {% if repo_type %}
{% if repo_type %} <div class="md-source__icon">
<div class="md-source__icon"> <svg viewBox="0 0 24 24" width="24" height="24">
<svg viewBox="0 0 24 24" width="24" height="24"> <use xlink:href="#__{{ repo_type }}" width="24" height="24"></use>
<use xlink:href="#__{{ repo_type }}" width="24" height="24"></use> </svg>
</svg>
</div>
{% endif %}
<div class="md-source__repository">
{{ config.repo_name }}
</div> </div>
</a> {% endif %}
{% endblock %} <div class="md-source__repository">
{{ config.repo_name }}
</div>
</a>

View File

@ -96,9 +96,7 @@
</div> </div>
<!-- Social links --> <!-- Social links -->
{% block social %} {% include "partials/social.html" %}
{% include "partials/social.html" %}
{% endblock %}
</div> </div>
</div> </div>
</footer> </footer>

View File

@ -50,32 +50,28 @@
<div class="md-flex__cell md-flex__cell--stretch"> <div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" <div class="md-flex__ellipsis md-header-nav__title"
data-md-component="title"> data-md-component="title">
{% block site_name %} {% if config.site_name == page.title %}
{% if config.site_name == page.title %} {{ config.site_name }}
{% else %}
<span class="md-header-nav__topic">
{{ config.site_name }} {{ config.site_name }}
{% else %} </span>
<span class="md-header-nav__topic"> <span class="md-header-nav__topic">
{{ config.site_name }} {{ page.title }}
</span> </span>
<span class="md-header-nav__topic"> {% endif %}
{{ page.title }}
</span>
{% endif %}
{% endblock %}
</div> </div>
</div> </div>
<!-- Button to open search dialogue --> <!-- Button to open search dialogue -->
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
{% block search_box %} {% if "search" in config["plugins"] %}
{% if "search" in config["plugins"] %} <label class="md-icon md-icon--search md-header-nav__button"
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
for="__search"></label>
<!-- Search interface --> <!-- Search interface -->
{% include "partials/search.html" %} {% include "partials/search.html" %}
{% endif %} {% endif %}
{% endblock %}
</div> </div>
<!-- Repository containing source --> <!-- Repository containing source -->

View File

@ -38,18 +38,16 @@
{% endif %} {% endif %}
<!-- Repository containing source --> <!-- Repository containing source -->
{% block repo %} <a href="{{ config.repo_url }}" title="{{ lang.t('source.link.title') }}"
<a href="{{ config.repo_url }}" title="{{ lang.t('source.link.title') }}" class="md-source" data-md-source="{{ repo_type }}">
class="md-source" data-md-source="{{ repo_type }}"> {% if repo_type %}
{% if repo_type %} <div class="md-source__icon">
<div class="md-source__icon"> <svg viewBox="0 0 24 24" width="24" height="24">
<svg viewBox="0 0 24 24" width="24" height="24"> <use xlink:href="#__{{ repo_type }}" width="24" height="24"></use>
<use xlink:href="#__{{ repo_type }}" width="24" height="24"></use> </svg>
</svg>
</div>
{% endif %}
<div class="md-source__repository">
{{ config.repo_name }}
</div> </div>
</a> {% endif %}
{% endblock %} <div class="md-source__repository">
{{ config.repo_name }}
</div>
</a>