Skip to content

Commit

Permalink
Removed level 1 headline hack in content partial
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Jan 2, 2023
1 parent 3901324 commit b95dffa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion material/partials/content.html
Expand Up @@ -5,7 +5,8 @@
{% include "partials/tags.html" %}
{% endif %}
{% 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>
{% endif %}
{{ page.content }}
Expand Down
5 changes: 3 additions & 2 deletions src/partials/content.html
Expand Up @@ -29,10 +29,11 @@
{% 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.
-->
{% 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>
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion src/partials/toc.html
Expand Up @@ -31,7 +31,7 @@
{% 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
to the current page that is located just above the anchor. Therefore we
directly continue with the children of the anchor.
Expand Down

0 comments on commit b95dffa

Please sign in to comment.