Skip to content

Commit

Permalink
Merge pull request #5056 from SupImDos/fix/content-headline-detection
Browse files Browse the repository at this point in the history
Reimplement `<h1>` headline detection in content partial
  • Loading branch information
squidfunk authored Feb 18, 2023
2 parents 05cd383 + a7fbd90 commit 3e8f042
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions material/partials/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
{% include "partials/tags.html" %}
{% endif %}
{% include "partials/actions.html" %}
{% set first = page.toc | first %}
{% if first and first.level != 1 %}
{% if "\x3ch1" not in page.content %}
<h1>{{ page.title | d(config.site_name, true)}}</h1>
{% endif %}
{{ page.content }}
Expand Down
5 changes: 2 additions & 3 deletions src/partials/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
{% 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.
-->
{% set first = page.toc | first %}
{% if first and first.level != 1 %}
{% if "\x3ch1" not in page.content %}
<h1>{{ page.title | d(config.site_name, true)}}</h1>
{% endif %}

Expand Down

0 comments on commit 3e8f042

Please sign in to comment.