Fixed site title behavior when using front matter

This commit is contained in:
squidfunk 2020-07-27 17:52:38 +02:00
parent af4f74b368
commit 1ec08b42dd
4 changed files with 5 additions and 6 deletions

View File

@ -1,6 +1,6 @@
---
template: overrides/main.html
title: Getting started - Material for MkDocs
title: Getting started
---
# Getting started

View File

@ -45,9 +45,8 @@ title: Lorem ipsum dolor sit amet
```
This will set the `title` tag inside the document `head` for the current page
to the provided value. It will also override the default behavior of Material
for MkDocs which appends the site title using a dash as a separator to the page
title.
to the provided value. Note that the site title is appended using a dash as a
separator, which is the default behavior.
[5]: #metadata

View File

@ -33,7 +33,7 @@
{% endblock %}
{% block htmltitle %}
{% if page and page.meta and page.meta.title %}
<title>{{ page.meta.title }}</title>
<title>{{ page.meta.title }} - {{ config.site_name }}</title>
{% elif page and page.title and not page.is_homepage %}
<title>{{ page.title | striptags }} - {{ config.site_name }}</title>
{% else %}

View File

@ -80,7 +80,7 @@
<!-- Site title -->
{% block htmltitle %}
{% if page and page.meta and page.meta.title %}
<title>{{ page.meta.title }}</title>
<title>{{ page.meta.title }} - {{ config.site_name }}</title>
{% elif page and page.title and not page.is_homepage %}
<title>{{ page.title | striptags }} - {{ config.site_name }}</title>
{% else %}