Moved logo to theme configuration and made search optional

This commit is contained in:
squidfunk 2017-10-31 19:06:19 +01:00 committed by Martin Donath
parent 5fbba74c80
commit 240a7afa8d
11 changed files with 39 additions and 45 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -53,7 +53,7 @@
<script src="{{ base_url }}/assets/javascripts/modernizr-e826f8942a.js"></script> <script src="{{ base_url }}/assets/javascripts/modernizr-e826f8942a.js"></script>
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-04ea671600.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-c7f552852f.css">
{% if palette.primary or palette.accent %} {% if palette.primary or palette.accent %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-23f75ab9c7.palette.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-23f75ab9c7.palette.css">
{% endif %} {% endif %}

View File

@ -36,6 +36,10 @@ font:
text: Roboto text: Roboto
# Fixed-width font for code listings # Fixed-width font for code listings
code: Roboto Mono code: Roboto Mono
# The logo of the documentation shown in the header and navigation can either
# be a Material Icon ligature or an image URL
logo:
icon: school
# Material includes the search in the header as a partial, not as a separate # Material includes the search in the header as a partial, not as a separate
# template, so it's correct that search.html is missing # template, so it's correct that search.html is missing
include_search_page: false include_search_page: false

View File

@ -3,14 +3,10 @@
<div class="md-flex"> <div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
<a href="{{ config.site_url | default(nav.homepage.url, true) }}" title="{{ config.site_name }}" class="md-header-nav__button md-logo"> <a href="{{ config.site_url | default(nav.homepage.url, true) }}" title="{{ config.site_name }}" class="md-header-nav__button md-logo">
{% if config.extra.logo %} {% if config.theme.logo.icon %}
{% if config.extra.logo.icon %} <i class="md-icon">{{ config.theme.logo.icon }}</i>
<i class="md-icon">{{ config.extra.logo.icon }}</i>
{% else %}
<img src="{{ base_url }}/{{ config.extra.logo }}" width="24" height="24">
{% endif %}
{% else %} {% else %}
<i class="md-icon md-icon--home"></i> <img src="{{ base_url }}/{{ config.theme.logo }}" width="24" height="24">
{% endif %} {% endif %}
</a> </a>
</div> </div>
@ -33,8 +29,10 @@
</div> </div>
<div class="md-flex__cell md-flex__cell--shrink"> <div class="md-flex__cell md-flex__cell--shrink">
{% block search_box %} {% block search_box %}
<label class="md-icon md-icon--search md-header-nav__button" for="search"></label> {% if "search" in config["plugins"] %}
{% include "partials/search.html" %} <label class="md-icon md-icon--search md-header-nav__button" for="search"></label>
{% include "partials/search.html" %}
{% endif %}
{% endblock %} {% endblock %}
</div> </div>
{% if config.repo_url %} {% if config.repo_url %}

View File

@ -1,14 +1,10 @@
<nav class="md-nav md-nav--primary" data-md-level="0"> <nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="drawer"> <label class="md-nav__title md-nav__title--site" for="drawer">
<span class="md-nav__button md-logo"> <span class="md-nav__button md-logo">
{% if config.extra.logo %} {% if config.theme.logo.icon %}
{% if config.extra.logo.icon %} <i class="md-icon">{{ config.theme.logo.icon }}</i>
<i class="md-icon">{{ config.extra.logo.icon }}</i>
{% else %}
<img src="{{ base_url }}/{{ config.extra.logo }}">
{% endif %}
{% else %} {% else %}
<i class="md-icon md-icon--home"></i> <img src="{{ base_url }}/{{ config.theme.logo }}" width="24" height="24">
{% endif %} {% endif %}
</span> </span>
{{ config.site_name }} {{ config.site_name }}

View File

@ -36,7 +36,7 @@ theme:
name: null name: null
custom_dir: material custom_dir: material
# Same values as in mkdocs_theme.yml # Default values, taken from mkdocs_theme.yml
language: en language: en
feature: feature:
tabs: false tabs: false
@ -46,14 +46,11 @@ theme:
font: font:
text: Roboto text: Roboto
code: Roboto Mono code: Roboto Mono
logo:
#plugins: [] icon: school
# Options # Options
extra: extra:
language: en
search:
languages: en, de, fr
social: social:
- type: globe - type: globe
link: http://struct.cc link: http://struct.cc

View File

@ -56,8 +56,7 @@
"\E5C4": "arrow-back", // arrow_back "\E5C4": "arrow-back", // arrow_back
"\E5C8": "arrow-forward", // arrow_forward "\E5C8": "arrow-forward", // arrow_forward
"\E5D2": "menu", // menu "\E5D2": "menu", // menu
"\E8B6": "search", // search "\E8B6": "search" // search
"\E80C": "home" // school
) { ) {
&--#{$name}::before { &--#{$name}::before {
content: $ligature; content: $ligature;

View File

@ -49,6 +49,11 @@ font:
# Fixed-width font for code listings # Fixed-width font for code listings
code: Roboto Mono code: Roboto Mono
# The logo of the documentation shown in the header and navigation can either
# be a Material Icon ligature or an image URL
logo:
icon: school
# Material includes the search in the header as a partial, not as a separate # Material includes the search in the header as a partial, not as a separate
# template, so it's correct that search.html is missing # template, so it's correct that search.html is missing
include_search_page: false include_search_page: false

View File

@ -32,15 +32,11 @@
<a href="{{ config.site_url | default(nav.homepage.url, true) }}" <a href="{{ config.site_url | default(nav.homepage.url, true) }}"
title="{{ config.site_name }}" title="{{ config.site_name }}"
class="md-header-nav__button md-logo"> class="md-header-nav__button md-logo">
{% if config.extra.logo %} {% if config.theme.logo.icon %}
{% if config.extra.logo.icon %} <i class="md-icon">{{ config.theme.logo.icon }}</i>
<i class="md-icon">{{ config.extra.logo.icon }}</i>
{% else %}
<img src="{{ base_url }}/{{ config.extra.logo }}"
width="24" height="24" />
{% endif %}
{% else %} {% else %}
<i class="md-icon md-icon--home"></i> <img src="{{ base_url }}/{{ config.theme.logo }}"
width="24" height="24" />
{% endif %} {% endif %}
</a> </a>
</div> </div>
@ -70,11 +66,13 @@
<!-- 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 %} {% block search_box %}
<label class="md-icon md-icon--search md-header-nav__button" {% if "search" in config["plugins"] %}
for="search"></label> <label class="md-icon md-icon--search md-header-nav__button"
for="search"></label>
<!-- Search interface --> <!-- Search interface -->
{% include "partials/search.html" %} {% include "partials/search.html" %}
{% endif %}
{% endblock %} {% endblock %}
</div> </div>

View File

@ -26,14 +26,11 @@
<!-- Site title --> <!-- Site title -->
<label class="md-nav__title md-nav__title--site" for="drawer"> <label class="md-nav__title md-nav__title--site" for="drawer">
<span class="md-nav__button md-logo"> <span class="md-nav__button md-logo">
{% if config.extra.logo %} {% if config.theme.logo.icon %}
{% if config.extra.logo.icon %} <i class="md-icon">{{ config.theme.logo.icon }}</i>
<i class="md-icon">{{ config.extra.logo.icon }}</i>
{% else %}
<img src="{{ base_url }}/{{ config.extra.logo }}" />
{% endif %}
{% else %} {% else %}
<i class="md-icon md-icon--home"></i> <img src="{{ base_url }}/{{ config.theme.logo }}"
width="24" height="24" />
{% endif %} {% endif %}
</span> </span>
{{ config.site_name }} {{ config.site_name }}