Skip to content

Commit 0c7d345

Browse files
committed
LOOP-1233: Fixed handling of empty headers
1 parent a8f1bae commit 0c7d345

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
{% if content.os2loop_documents_title is not empty %}
1+
{# @see https://www.previousnext.com.au/blog/right-way-check-empty-content-twig #}
2+
{% set rendered_title = content.os2loop_documents_title|render %}
3+
{% if rendered_title|trim %}
24
{% set toc_ignore = paragraph.get('os2loop_documents_toc_ignore').value == 1 %}
3-
<h2 class="{{ toc_ignore ? 'toc-ignore' }}">{{ content.os2loop_documents_title }}</h2>
5+
<h2 class="{{ toc_ignore ? 'toc-ignore' }}">{{ rendered_title }}</h2>
46
{% endif %}

0 commit comments

Comments
 (0)