mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Merge pull request #5056 from SupImDos/fix/content-headline-detection
Reimplement `<h1>` headline detection in content partial
This commit is contained in:
commit
3e8f04294c
@ -5,8 +5,7 @@
|
|||||||
{% include "partials/tags.html" %}
|
{% include "partials/tags.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include "partials/actions.html" %}
|
{% include "partials/actions.html" %}
|
||||||
{% set first = page.toc | first %}
|
{% if "\x3ch1" not in page.content %}
|
||||||
{% if first and first.level != 1 %}
|
|
||||||
<h1>{{ page.title | d(config.site_name, true)}}</h1>
|
<h1>{{ page.title | d(config.site_name, true)}}</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ page.content }}
|
{{ page.content }}
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
{% include "partials/actions.html" %}
|
{% include "partials/actions.html" %}
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Check whether the content starts with a level 1 headline. If it doesn't, the
|
Hack: check whether the content contains a h1 headline. If it doesn't, the
|
||||||
page title (or respectively site name) is used as the main headline.
|
page title (or respectively site name) is used as the main headline.
|
||||||
-->
|
-->
|
||||||
{% set first = page.toc | first %}
|
{% if "\x3ch1" not in page.content %}
|
||||||
{% if first and first.level != 1 %}
|
|
||||||
<h1>{{ page.title | d(config.site_name, true)}}</h1>
|
<h1>{{ page.title | d(config.site_name, true)}}</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user