Removed unnecessary safe guards in templates

This commit is contained in:
squidfunk 2022-06-04 07:51:12 +02:00
parent fdb409dea6
commit 95f80479a2
10 changed files with 20 additions and 20 deletions

View File

@ -8,12 +8,12 @@
{% block site_meta %} {% block site_meta %}
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
{% if page and page.meta and page.meta.description %} {% if page.meta and page.meta.description %}
<meta name="description" content="{{ page.meta.description }}"> <meta name="description" content="{{ page.meta.description }}">
{% elif config.site_description %} {% elif config.site_description %}
<meta name="description" content="{{ config.site_description }}"> <meta name="description" content="{{ config.site_description }}">
{% endif %} {% endif %}
{% if page and page.meta and page.meta.author %} {% if page.meta and page.meta.author %}
<meta name="author" content="{{ page.meta.author }}"> <meta name="author" content="{{ page.meta.author }}">
{% elif config.site_author %} {% elif config.site_author %}
<meta name="author" content="{{ config.site_author }}"> <meta name="author" content="{{ config.site_author }}">
@ -25,9 +25,9 @@
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-8.3.0"> <meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-8.3.0">
{% endblock %} {% endblock %}
{% block htmltitle %} {% block htmltitle %}
{% if page and page.meta and page.meta.title %} {% if page.meta and page.meta.title %}
<title>{{ page.meta.title }} - {{ config.site_name }}</title> <title>{{ page.meta.title }} - {{ config.site_name }}</title>
{% elif page and page.title and not page.is_homepage %} {% elif page.title and not page.is_homepage %}
<title>{{ page.title | striptags }} - {{ config.site_name }}</title> <title>{{ page.title | striptags }} - {{ config.site_name }}</title>
{% else %} {% else %}
<title>{{ config.site_name }}</title> <title>{{ config.site_name }}</title>
@ -135,7 +135,7 @@
<div class="md-main__inner md-grid"> <div class="md-main__inner md-grid">
{% block site_nav %} {% block site_nav %}
{% if nav %} {% if nav %}
{% if page and page.meta and page.meta.hide %} {% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "navigation" in page.meta.hide %} {% set hidden = "hidden" if "navigation" in page.meta.hide %}
{% endif %} {% endif %}
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" {{ hidden }}> <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" {{ hidden }}>
@ -147,7 +147,7 @@
</div> </div>
{% endif %} {% endif %}
{% if not "toc.integrate" in features %} {% if not "toc.integrate" in features %}
{% if page and page.meta and page.meta.hide %} {% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "toc" in page.meta.hide %} {% set hidden = "hidden" if "toc" in page.meta.hide %}
{% endif %} {% endif %}
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" {{ hidden }}> <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" {{ hidden }}>

View File

@ -18,7 +18,7 @@
<h1>{{ page.title | d(config.site_name, true)}}</h1> <h1>{{ page.title | d(config.site_name, true)}}</h1>
{% endif %} {% endif %}
{{ page.content }} {{ page.content }}
{% if page and page.meta and ( {% if page.meta and (
page.meta.git_revision_date_localized or page.meta.git_revision_date_localized or
page.meta.revision_date page.meta.revision_date
) %} ) %}

View File

@ -13,7 +13,7 @@
<h1>{{ page.title | d(config.site_name, true)}}</h1> <h1>{{ page.title | d(config.site_name, true)}}</h1>
{% endif %} {% endif %}
{{ page.content }} {{ page.content }}
{% if page and page.meta and ( {% if page.meta and (
page.meta.git_revision_date_localized or page.meta.git_revision_date_localized or
page.meta.revision_date page.meta.revision_date
) %} ) %}

View File

@ -22,7 +22,7 @@
</div> </div>
<div class="md-header__topic" data-md-component="header-topic"> <div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis"> <span class="md-ellipsis">
{% if page and page.meta and page.meta.title %} {% if page.meta and page.meta.title %}
{{ page.meta.title }} {{ page.meta.title }}
{% else %} {% else %}
{{ page.title }} {{ page.title }}

View File

@ -1,7 +1,7 @@
{#- {#-
This file was automatically generated - do not edit This file was automatically generated - do not edit
-#} -#}
{% if page and 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 %} {% if tags %}

View File

@ -32,14 +32,14 @@
<meta name="viewport" content="width=device-width,initial-scale=1" /> <meta name="viewport" content="width=device-width,initial-scale=1" />
<!-- Page description --> <!-- Page description -->
{% if page and page.meta and page.meta.description %} {% if page.meta and page.meta.description %}
<meta name="description" content="{{ page.meta.description }}" /> <meta name="description" content="{{ page.meta.description }}" />
{% elif config.site_description %} {% elif config.site_description %}
<meta name="description" content="{{ config.site_description }}" /> <meta name="description" content="{{ config.site_description }}" />
{% endif %} {% endif %}
<!-- Page author --> <!-- Page author -->
{% if page and page.meta and page.meta.author %} {% if page.meta and page.meta.author %}
<meta name="author" content="{{ page.meta.author }}" /> <meta name="author" content="{{ page.meta.author }}" />
{% elif config.site_author %} {% elif config.site_author %}
<meta name="author" content="{{ config.site_author }}" /> <meta name="author" content="{{ config.site_author }}" />
@ -62,9 +62,9 @@
<!-- Site title --> <!-- Site title -->
{% block htmltitle %} {% block htmltitle %}
{% if page and page.meta and page.meta.title %} {% if page.meta and page.meta.title %}
<title>{{ page.meta.title }} - {{ config.site_name }}</title> <title>{{ page.meta.title }} - {{ config.site_name }}</title>
{% elif page and page.title and not page.is_homepage %} {% elif page.title and not page.is_homepage %}
<title>{{ page.title | striptags }} - {{ config.site_name }}</title> <title>{{ page.title | striptags }} - {{ config.site_name }}</title>
{% else %} {% else %}
<title>{{ config.site_name }}</title> <title>{{ config.site_name }}</title>
@ -253,7 +253,7 @@
<!-- Navigation --> <!-- Navigation -->
{% if nav %} {% if nav %}
{% if page and page.meta and page.meta.hide %} {% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "navigation" in page.meta.hide %} {% set hidden = "hidden" if "navigation" in page.meta.hide %}
{% endif %} {% endif %}
<div <div
@ -272,7 +272,7 @@
<!-- Table of contents --> <!-- Table of contents -->
{% if not "toc.integrate" in features %} {% if not "toc.integrate" in features %}
{% if page and page.meta and page.meta.hide %} {% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "toc" in page.meta.hide %} {% set hidden = "hidden" if "toc" in page.meta.hide %}
{% endif %} {% endif %}
<div <div

View File

@ -58,7 +58,7 @@
{{ page.content }} {{ page.content }}
<!-- Source file information --> <!-- Source file information -->
{% if page and page.meta and ( {% if page.meta and (
page.meta.git_revision_date_localized or page.meta.git_revision_date_localized or
page.meta.revision_date page.meta.revision_date
) %} ) %}

View File

@ -49,7 +49,7 @@
{{ page.content }} {{ page.content }}
<!-- Source file information --> <!-- Source file information -->
{% if page and page.meta and ( {% if page.meta and (
page.meta.git_revision_date_localized or page.meta.git_revision_date_localized or
page.meta.revision_date page.meta.revision_date
) %} ) %}

View File

@ -59,7 +59,7 @@
</div> </div>
<div class="md-header__topic" data-md-component="header-topic"> <div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis"> <span class="md-ellipsis">
{% if page and page.meta and page.meta.title %} {% if page.meta and page.meta.title %}
{{ page.meta.title }} {{ page.meta.title }}
{% else %} {% else %}
{{ page.title }} {{ page.title }}

View File

@ -21,7 +21,7 @@
--> -->
<!-- Determine whether to show tags --> <!-- Determine whether to show tags -->
{% if page and 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 %}