1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-30 18:24:35 +01:00

Moved condition outside of tags partial

This commit is contained in:
squidfunk 2023-08-21 18:06:46 +02:00
parent efdb146c30
commit 0de17c6197
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 42 additions and 46 deletions

View File

@ -1,7 +1,7 @@
{#- {#-
This file was automatically generated - do not edit This file was automatically generated - do not edit
-#} -#}
{% if "material/tags" in config.plugins %} {% if "material/tags" in config.plugins and tags %}
{% include "partials/tags.html" %} {% include "partials/tags.html" %}
{% endif %} {% endif %}
{% include "partials/actions.html" %} {% include "partials/actions.html" %}

View File

@ -4,25 +4,23 @@
{% if page.meta and page.meta.hide %} {% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "tags" in page.meta.hide %} {% set hidden = "hidden" if "tags" in page.meta.hide %}
{% endif %} {% endif %}
{% if tags %} <nav class="md-tags" {{ hidden }}>
<nav class="md-tags" {{ hidden }}> {% for tag in tags %}
{% for tag in tags %} {% set icon = "" %}
{% set icon = "" %} {% if config.extra.tags %}
{% if config.extra.tags %} {% set icon = " md-tag-icon" %}
{% set icon = " md-tag-icon" %} {% if tag.type %}
{% if tag.type %} {% set icon = icon ~ " md-tag--" ~ tag.type %}
{% set icon = icon ~ " md-tag--" ~ tag.type %}
{% endif %}
{% endif %} {% endif %}
{% if tag.url %} {% endif %}
<a href="{{ tag.url | url }}" class="md-tag{{ icon }}"> {% if tag.url %}
{{- tag.name -}} <a href="{{ tag.url | url }}" class="md-tag{{ icon }}">
</a> {{- tag.name -}}
{% else %} </a>
<span class="md-tag{{ icon }}"> {% else %}
{{- tag.name -}} <span class="md-tag{{ icon }}">
</span> {{- tag.name -}}
{% endif %} </span>
{% endfor %} {% endif %}
</nav> {% endfor %}
{% endif %} </nav>

View File

@ -21,7 +21,7 @@
--> -->
<!-- Tags --> <!-- Tags -->
{% if "material/tags" in config.plugins %} {% if "material/tags" in config.plugins and tags %}
{% include "partials/tags.html" %} {% include "partials/tags.html" %}
{% endif %} {% endif %}

View File

@ -26,29 +26,27 @@
{% endif %} {% endif %}
<!-- Tags --> <!-- Tags -->
{% if tags %} <nav class="md-tags" {{ hidden }}>
<nav class="md-tags" {{ hidden }}> {% for tag in tags %}
{% for tag in tags %} {% set icon = "" %}
{% set icon = "" %} {% if config.extra.tags %}
{% if config.extra.tags %} {% set icon = " md-tag-icon" %}
{% set icon = " md-tag-icon" %} {% if tag.type %}
{% if tag.type %} {% set icon = icon ~ " md-tag--" ~ tag.type %}
{% set icon = icon ~ " md-tag--" ~ tag.type %}
{% endif %}
{% endif %} {% endif %}
{% endif %}
<!-- Render tag with link --> <!-- Render tag with link -->
{% if tag.url %} {% if tag.url %}
<a href="{{ tag.url | url }}" class="md-tag{{ icon }}"> <a href="{{ tag.url | url }}" class="md-tag{{ icon }}">
{{- tag.name -}} {{- tag.name -}}
</a> </a>
<!-- Render tag without link --> <!-- Render tag without link -->
{% else %} {% else %}
<span class="md-tag{{ icon }}"> <span class="md-tag{{ icon }}">
{{- tag.name -}} {{- tag.name -}}
</span> </span>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</nav> </nav>
{% endif %}