From 50db22dc50ff76b2bfa8776d35414826243e6a06 Mon Sep 17 00:00:00 2001 From: Brummel Date: Thu, 21 May 2026 12:16:06 +0200 Subject: [PATCH] fix(markup): match live twig templates for anchor wrap and content wrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three corrections after diffing the rebuild against the actual theme twig templates (modular/news.html.twig, employees.html.twig, about.html.twig): 1. section_title macro learns a `with_anchor` flag for the case where live always wraps the h2 in `
` even with an empty anchor id. Default behavior unchanged. 2. team_carousel macro drops its `.anchor` wrapper around the title. employees.html.twig renders the h2 directly — including the wrapper was producing an extra layout element on /team that live doesn't have. 3. index.html's news section now calls section_title with with_anchor=true and wraps the loaded news content in an outer

, reproducing the grav markdown pipeline's behavior (the outer

auto-closes on the first inner

, leaving one leading empty

that contributes the expected 10px margin). --- templates/index.html | 9 +++++++-- templates/macros/section_title.html | 8 ++++++-- templates/macros/team_carousel.html | 8 ++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/templates/index.html b/templates/index.html index a103f7f..c0b253f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -34,12 +34,17 @@

{# ───────── News (loaded from content/news.md) ───────── #} +{# Mirror live's news.html.twig: section-title always wraps the h2 in + `.anchor` (with empty id), and the content lands inside an outer

+ tag — the auto-close on the first inner

yields one leading + empty

, which contributes the 10px-margin that Grav's markdown + pipeline produces. #} {% set news_page = get_page(path="news.md") %}
- {{ st::section_title(title="Aktuelles") }} + {{ st::section_title(title="Aktuelles", with_anchor=true) }}
- {{ news_page.content | safe }} +

{{ news_page.content | safe }}

diff --git a/templates/macros/section_title.html b/templates/macros/section_title.html index 1db100e..0e01f8a 100644 --- a/templates/macros/section_title.html +++ b/templates/macros/section_title.html @@ -1,7 +1,11 @@ -{% macro section_title(title, anchor="") %} +{# `with_anchor=true` forces the `
` wrap + even when the anchor id is empty — matches the live news.html.twig + which always renders the wrap. A non-empty `anchor` argument implies + `with_anchor=true` automatically. #} +{% macro section_title(title, anchor="", with_anchor=false) %}
- {%- if anchor %} + {%- if anchor or with_anchor %}

{{ title }}

diff --git a/templates/macros/team_carousel.html b/templates/macros/team_carousel.html index da0bfe0..76cbed3 100644 --- a/templates/macros/team_carousel.html +++ b/templates/macros/team_carousel.html @@ -1,14 +1,10 @@ {% macro team_carousel(title, anchor, slides) %}
+ {# Live's employees.html.twig renders the h2 directly, without an + `.anchor` wrapper — keep that to match its vertical rhythm. #}
- {%- if anchor %} -
-

{{ title }}

-
- {%- else %}

{{ title }}

- {%- endif %}