Skip to content

Commit

Permalink
Fixed error when only setting a single icon
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Mar 11, 2020
1 parent 4d386df commit fcbd47c
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 22 deletions.
6 changes: 0 additions & 6 deletions material/mkdocs_theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ font:
# icons that are part of the HTML can be configured and replaced
icon:

# Shown if no logo is set
logo: material/library

# Repository icon
repo: fontawesome/brands/git-alt

# Favicon to be rendered
favicon: assets/images/favicon.png

Expand Down
3 changes: 2 additions & 1 deletion material/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo">
{% else %}
{% include ".icons/" ~ config.theme.icon.logo ~ ".svg" %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}
</a>
<label class="md-header-nav__button md-icon" for="__drawer">
Expand Down
3 changes: 2 additions & 1 deletion material/partials/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo">
{% else %}
{% include ".icons/" ~ config.theme.icon.logo ~ ".svg" %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}
</a>
{{ config.site_name }}
Expand Down
3 changes: 2 additions & 1 deletion material/partials/source-link.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
{% set path = page.meta.path | default([""]) %}
<a href="{{ [repo, path, page.meta.source] | join('/') }}" title="{{ page.meta.source }}" class="md-content__button md-icon">
{{ lang.t("meta.source") }}
{% include ".icons/" ~ config.theme.icon.repo ~ ".svg" %}
{% set icon = config.theme.icon.repo or "fontawesome/brands/git-alt" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</a>
3 changes: 2 additions & 1 deletion material/partials/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{% import "partials/language.html" as lang with context %}
<a href="{{ config.repo_url }}" title="{{ lang.t('source.link.title') }}" class="md-source">
<div class="md-source__icon md-icon">
{% include ".icons/" ~ config.theme.icon.repo ~ ".svg" %}
{% set icon = config.theme.icon.repo or "fontawesome/brands/git-alt" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</div>
<div class="md-source__repository">
{{ config.repo_name }}
Expand Down
2 changes: 0 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ theme:
text: Roboto
code: Roboto Mono
icon:
logo: material/library
repo: fontawesome/brands/git-alt
favicon: assets/favicon.png
logo: assets/images/icon.svg

Expand Down
6 changes: 0 additions & 6 deletions src/mkdocs_theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ font:
# icons that are part of the HTML can be configured and replaced
icon:

# Shown if no logo is set
logo: material/library

# Repository icon
repo: fontawesome/brands/git-alt

# Favicon to be rendered
favicon: assets/images/favicon.png

Expand Down
3 changes: 2 additions & 1 deletion src/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo" />
{% else %}
{% include ".icons/" ~ config.theme.icon.logo ~ ".svg" %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}
</a>
<label
Expand Down
3 changes: 2 additions & 1 deletion src/partials/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
{% if config.theme.logo %}
<img src="{{ config.theme.logo | url }}" alt="logo" />
{% else %}
{% include ".icons/" ~ config.theme.icon.logo ~ ".svg" %}
{% set icon = config.theme.icon.logo or "material/library" %}
{% include ".icons/" ~ icon ~ ".svg" %}
{% endif %}
</a>
{{ config.site_name }}
Expand Down
3 changes: 2 additions & 1 deletion src/partials/source-link.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
class="md-content__button md-icon"
>
{{ lang.t("meta.source") }}
{% include ".icons/" ~ config.theme.icon.repo ~ ".svg" %}
{% set icon = config.theme.icon.repo or "fontawesome/brands/git-alt" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</a>
3 changes: 2 additions & 1 deletion src/partials/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
class="md-source"
>
<div class="md-source__icon md-icon">
{% include ".icons/" ~ config.theme.icon.repo ~ ".svg" %}
{% set icon = config.theme.icon.repo or "fontawesome/brands/git-alt" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</div>
<div class="md-source__repository">
{{ config.repo_name }}
Expand Down

0 comments on commit fcbd47c

Please sign in to comment.