Removed level 1 headline hack in content partial

This commit is contained in:
squidfunk 2023-01-02 11:27:41 +01:00
parent 39013249a5
commit b95dffa5cd
3 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,8 @@
{% include "partials/tags.html" %} {% include "partials/tags.html" %}
{% endif %} {% endif %}
{% include "partials/actions.html" %} {% include "partials/actions.html" %}
{% if "\x3ch1" not in page.content %} {% set first = page.toc | first %}
{% 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 }}

View File

@ -29,10 +29,11 @@
{% include "partials/actions.html" %} {% include "partials/actions.html" %}
<!-- <!--
Hack: check whether the content contains a h1 headline. If it doesn't, the Check whether the content starts with a level 1 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.
--> -->
{% if "\x3ch1" not in page.content %} {% set first = page.toc | first %}
{% 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 %}

View File

@ -31,7 +31,7 @@
{% set toc = page.toc %} {% set toc = page.toc %}
<!-- <!--
Hack: check whether the content contains a h1 headline. If it does, the Check whether the content starts with a level 1 headline. If it does, the
top-level anchor must be skipped, since it would be redundant to the link top-level anchor must be skipped, since it would be redundant to the link
to the current page that is located just above the anchor. Therefore we to the current page that is located just above the anchor. Therefore we
directly continue with the children of the anchor. directly continue with the children of the anchor.