diff --git a/theme/templates/macros/content_renderer.html b/theme/templates/macros/content_renderer.html index 40640744c49f999e8b0e90bc723ddecee63a169f..164c42dad355126e400d99ef2373d6a3b9d252a2 100644 --- a/theme/templates/macros/content_renderer.html +++ b/theme/templates/macros/content_renderer.html @@ -1,8 +1,8 @@ {#- Siehe https://gitlab.gwdg.de/GAUMI-fginfo/fg-website/-/blob/better-content-renderer/docs/content.md -#} -{%- macro render_content(content, lang) -%} - {%- set meta = namespace() -%} +{%- macro render_content(content, lang, header_level_offset) -%} + {%- set meta = namespace(header_level_offset=header_level_offset) -%} {{ render_blocks(content, lang, meta) }} {%- endmacro -%} @@ -101,7 +101,7 @@ {%- set attr = block['attr'] -%} {%- set content = block['content'] -%} - {{ render_header(content, level, attr, lang) }} + {{ render_header(content, level + meta.header_level_offset, attr, lang) }} {%- endmacro -%} {%- macro render_block_paragraph(block, lang, meta) -%} diff --git a/theme/templates/macros/renderers.html b/theme/templates/macros/renderers.html index 56775135ace19daeca07ec346a620d50f3ef444a..1e5d02271e29fdd5bc5775ccf1c13688d0876bdb 100644 --- a/theme/templates/macros/renderers.html +++ b/theme/templates/macros/renderers.html @@ -11,27 +11,27 @@ <iframe src="{{ s.url }}" loading="lazy"></iframe> {%- endmacro -%} -{%- macro section_tag(s, lang) -%} +{%- macro section_tag(s, lang, header_level) -%} {%- if s.title is not defined -%} - {{ common.render_header(s.tag.title, 2, {"id": s.id}, lang) }} + {{ common.render_header(s.tag.title, header_level, {"id": s.id}, lang) }} {%- endif -%} {{ cards.cards_from_pages(s.tag.pages, lang, max=s.num|d(None)) }} {%- if s.tag.page -%} - {{ content_renderer.render_content(s.tag.page.content, lang) }} + {{ content_renderer.render_content(s.tag.page.content, lang, header_level - 1) }} {%- endif -%} {%- endmacro -%} -{%- macro section(s, lang) -%} +{%- macro section(s, lang, header_level) -%} {%- if s.title is defined -%} - {{ common.render_header(s.title[lang], 2, {"id": s.id}, lang) }} + {{ common.render_header(s.title[lang], header_level, {"id": s.id}, lang) }} {%- endif -%} {%- if s.type == "news" -%} {{ section_news(s, lang) }} {%- elif s.type == "iframe" -%} {{ section_iframe(s, lang) }} {%- elif s.type == "tag" -%} - {{ section_tag(s, lang) }} + {{ section_tag(s, lang, header_level) }} {%- elif s.type == "relevant" -%} {{ section_relevant(s, lang) }} {%- else -%} @@ -41,10 +41,10 @@ {%- endif -%} {%- endmacro -%} -{%- macro sections(sl, lang) -%} +{%- macro sections(sl, lang, header_level) -%} {%- for s in sl -%} <section> - {{ section(s, lang) }} + {{ section(s, lang, header_level) }} </section> {%- endfor -%} {%- endmacro -%} diff --git a/theme/templates/page.html b/theme/templates/page.html index 8e0b53a3dfb60be1be810c57a2c0e23d16ec9c9f..db51dd05116f09d185fb10ba45f8eb1dbb0282da 100644 --- a/theme/templates/page.html +++ b/theme/templates/page.html @@ -16,11 +16,11 @@ {% endblock %} {% block page_content %} {%- if 'before' in page.metadata -%} - {{ render.sections(page.metadata.before, l) }} + {{ render.sections(page.metadata.before, l, 2) }} {%- endif -%} - {{ content_renderer.render_content(page.content, l) }} + {{ content_renderer.render_content(page.content, l, 0) }} {%- if 'after' in page.metadata -%} - {{ render.sections(page.metadata.after, l) }} + {{ render.sections(page.metadata.after, l, 2) }} {%- endif -%} {% endblock %} </article> diff --git a/theme/templates/tag.html b/theme/templates/tag.html index cf8d5cf4f9ea68baeeb7a8753680586ff7999e5f..de38594d44e51308784f36470d07a72067bcc991 100644 --- a/theme/templates/tag.html +++ b/theme/templates/tag.html @@ -8,7 +8,7 @@ {% block main %} <section> - {{ render.section({"type": "tag", "tag": tag, "num": None}, l) }} + {{ render.section({"type": "tag", "tag": tag, "num": None}, l, 1) }} </section> {% endblock main %}