fix(markup): match live twig templates for anchor wrap and content wrap
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 `<div class="anchor" id="">` 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 <p>, reproducing the grav markdown pipeline's behavior (the outer <p> auto-closes on the first inner <p>, leaving one leading empty <p> that contributes the expected 10px margin).
This commit is contained in:
@@ -34,12 +34,17 @@
|
||||
</div>
|
||||
|
||||
{# ───────── 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 <p>
|
||||
tag — the auto-close on the first inner <p> yields one leading
|
||||
empty <p></p>, which contributes the 10px-margin that Grav's markdown
|
||||
pipeline produces. #}
|
||||
{% set news_page = get_page(path="news.md") %}
|
||||
<section class="news-text ptb-text" id="aktuelles">
|
||||
{{ st::section_title(title="Aktuelles") }}
|
||||
{{ st::section_title(title="Aktuelles", with_anchor=true) }}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{{ news_page.content | safe }}
|
||||
<p>{{ news_page.content | safe }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
{% macro section_title(title, anchor="") %}
|
||||
{# `with_anchor=true` forces the `<div class="anchor" id="...">` 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) %}
|
||||
<section class="section-title">
|
||||
<div class="container text-center">
|
||||
{%- if anchor %}
|
||||
{%- if anchor or with_anchor %}
|
||||
<div class="anchor" id="{{ anchor }}">
|
||||
<h2>{{ title }}</h2>
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
{% macro team_carousel(title, anchor, slides) %}
|
||||
<section class="employees">
|
||||
{# Live's employees.html.twig renders the h2 directly, without an
|
||||
`.anchor` wrapper — keep that to match its vertical rhythm. #}
|
||||
<section class="section-title">
|
||||
<div class="container text-center">
|
||||
{%- if anchor %}
|
||||
<div class="anchor" id="{{ anchor }}">
|
||||
<h2>{{ title }}</h2>
|
||||
</div>
|
||||
{%- else %}
|
||||
<h2>{{ title }}</h2>
|
||||
{%- endif %}
|
||||
<span class="bordered-icon"><i class="fa fa-circle-thin"></i></span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user