Moved logo to partials

This commit is contained in:
squidfunk 2020-03-26 15:38:50 +01:00
parent c7e294c9fa
commit c9b2c1eaab
7 changed files with 66 additions and 40 deletions

View File

@ -468,7 +468,7 @@ matches the new structure:
#### `partials/header.html`
``` diff
@@ -2,51 +2,48 @@
@@ -2,51 +2,43 @@
This file was automatically generated - do not edit
-#}
<header class="md-header" data-md-component="header">
@ -504,12 +504,7 @@ matches the new structure:
- {% endif %}
+ <nav class="md-header-nav md-grid" aria-label="{{ lang.t('header.title') }}">
+ <a href="{{ config.site_url | default(nav.homepage.url, true) | url }}" title="{{ config.site_name }}" class="md-header-nav__button md-logo" aria-label="{{ config.site_name }}">
+ {% if config.theme.logo %}
+ <img src="{{ config.theme.logo | url }}" alt="logo">
+ {% else %}
+ {% set icon = config.theme.icon.logo or "material/library" %}
+ {% include ".icons/" ~ icon ~ ".svg" %}
+ {% endif %}
+ {% include "partials/logo.html" %}
+ </a>
+ <label class="md-header-nav__button md-icon" for="__drawer">
+ {% include ".icons/material/menu" ~ ".svg" %}
@ -596,6 +591,21 @@ matches the new structure:
+{% macro t(key) %}{{ lang.t(key) | default(fallback.t(key)) }}{% endmacro %}
```
#### `partials/logo.html`
``` diff
@@ -0,0 +1,9 @@
+{#-
+ This file was automatically generated - do not edit
+-#}
+{% if config.theme.logo %}
+ <img src="{{ config.theme.logo | url }}" alt="logo">
+{% else %}
+ {% set icon = config.theme.icon.logo or "material/library" %}
+ {% include ".icons/" ~ icon ~ ".svg" %}
+{% endif %}
```
#### `partials/nav-item.html`
``` diff
@ -631,7 +641,7 @@ matches the new structure:
#### `partials/nav.html`
``` diff
@@ -1,13 +1,14 @@
@@ -1,14 +1,10 @@
{#-
This file was automatically generated - do not edit
-#}
@ -640,18 +650,16 @@ matches the new structure:
- <a href="{{ config.site_url | default(nav.homepage.url, true) | url }}" title="{{ config.site_name }}" class="md-nav__button md-logo">
- {% if config.theme.logo.icon %}
- <i class="md-icon">{{ config.theme.logo.icon }}</i>
- {% else %}
- <img alt="logo" src="{{ config.theme.logo | url }}" width="48" height="48">
- {% endif %}
+<nav class="md-nav md-nav--primary" aria-label="{{ lang.t('nav.title') }}" data-md-level="0">
+ <label class="md-nav__title" for="__drawer">
+ <a href="{{ config.site_url | default(nav.homepage.url, true) | url }}" title="{{ config.site_name }}" aria-label="{{ config.site_name }}" class="md-nav__button md-logo">
+ {% if config.theme.logo %}
+ <img src="{{ config.theme.logo | url }}" alt="logo">
{% else %}
- <img alt="logo" src="{{ config.theme.logo | url }}" width="48" height="48">
+ {% set icon = config.theme.icon.logo or "material/library" %}
+ {% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}
+ <a href="{{ config.site_url | default(nav.homepage.url, true) | url }}" title="{{ config.site_name }}" class="md-nav__button md-logo" aria-label="{{ config.site_name }}">
+ {% include "partials/logo.html" %}
</a>
{{ config.site_name }}
</label>
```
#### `partials/search.html`

View File

@ -4,12 +4,7 @@
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid" aria-label="{{ lang.t('header.title') }}">
<a href="{{ config.site_url | default(nav.homepage.url, true) | url }}" title="{{ config.site_name }}" class="md-header-nav__button md-logo" aria-label="{{ config.site_name }}">
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo">
{% else %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}
{% include "partials/logo.html" %}
</a>
<label class="md-header-nav__button md-icon" for="__drawer">
{% include ".icons/material/menu" ~ ".svg" %}

View File

@ -0,0 +1,9 @@
{#-
This file was automatically generated - do not edit
-#}
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo">
{% else %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}

View File

@ -4,12 +4,7 @@
<nav class="md-nav md-nav--primary" aria-label="{{ lang.t('nav.title') }}" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="{{ config.site_url | default(nav.homepage.url, true) | url }}" title="{{ config.site_name }}" class="md-nav__button md-logo" aria-label="{{ config.site_name }}">
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo">
{% else %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}
{% include "partials/logo.html" %}
</a>
{{ config.site_name }}
</label>

View File

@ -33,12 +33,7 @@
class="md-header-nav__button md-logo"
aria-label="{{ config.site_name }}"
>
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo" />
{% else %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}
{% include "partials/logo.html" %}
</a>
<!-- Button to open drawer -->

29
src/partials/logo.html Normal file
View File

@ -0,0 +1,29 @@
<!--
Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->
<!-- Logo -->
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo" />
{% else %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}

View File

@ -35,12 +35,7 @@
class="md-nav__button md-logo"
aria-label="{{ config.site_name }}"
>
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo" />
{% else %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}
{% include "partials/logo.html" %}
</a>
{{ config.site_name }}
</label>