mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed malformed Google Fonts url when a font setting was omitted
This commit is contained in:
parent
791c69af7b
commit
64e5ed0ed7
@ -50,13 +50,14 @@
|
|||||||
{% block libs %}{% endblock %}
|
{% block libs %}{% endblock %}
|
||||||
{% block fonts %}
|
{% block fonts %}
|
||||||
{% if config.theme.font != false %}
|
{% if config.theme.font != false %}
|
||||||
{% set font = config.theme.font %}
|
{% set text = config.theme.font.text | d("Roboto", true) %}
|
||||||
|
{% set code = config.theme.font.code | d("Roboto Mono", true) %}
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{
|
||||||
font.text | replace(' ', '+') + ':300,300i,400,400i,700,700i%7C' +
|
text | replace(' ', '+') + ':300,300i,400,400i,700,700i%7C' +
|
||||||
font.code | replace(' ', '+') + ':400,400i,700,700i'
|
code | replace(' ', '+') + ':400,400i,700,700i'
|
||||||
}}&display=fallback">
|
}}&display=fallback">
|
||||||
<style>:root{--md-text-font:"{{ font.text }}";--md-code-font:"{{ font.code }}"}</style>
|
<style>:root{--md-text-font:"{{ text }}";--md-code-font:"{{ code }}"}</style>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% for path in config["extra_css"] %}
|
{% for path in config["extra_css"] %}
|
||||||
|
@ -102,19 +102,20 @@
|
|||||||
|
|
||||||
<!-- Load fonts from Google -->
|
<!-- Load fonts from Google -->
|
||||||
{% if config.theme.font != false %}
|
{% if config.theme.font != false %}
|
||||||
{% set font = config.theme.font %}
|
{% set text = config.theme.font.text | d("Roboto", true) %}
|
||||||
|
{% set code = config.theme.font.code | d("Roboto Mono", true) %}
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://fonts.googleapis.com/css?family={{
|
href="https://fonts.googleapis.com/css?family={{
|
||||||
font.text | replace(' ', '+') + ':300,300i,400,400i,700,700i%7C' +
|
text | replace(' ', '+') + ':300,300i,400,400i,700,700i%7C' +
|
||||||
font.code | replace(' ', '+') + ':400,400i,700,700i'
|
code | replace(' ', '+') + ':400,400i,700,700i'
|
||||||
}}&display=fallback"
|
}}&display=fallback"
|
||||||
/>
|
/>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--md-text-font: "{{ font.text }}";
|
--md-text-font: "{{ text }}";
|
||||||
--md-code-font: "{{ font.code }}";
|
--md-code-font: "{{ code }}";
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user