From 8789acaa4297a3801df4e62cc98ff58f5ccea013 Mon Sep 17 00:00:00 2001 From: MoritzWeber0 Date: Fri, 24 Apr 2026 19:53:46 +0200 Subject: [PATCH 1/3] feat: Improve expander handling in search --- assets/sass/booking.scss | 14 ++++++++ assets/sass/headings.scss | 36 +++++++++++++++---- assets/sass/trainCategory.scss | 6 ++-- layouts/partials/booking/booking.html | 10 ++++-- .../partials/pagefind-ignore-headings.html | 4 +++ layouts/partials/train-category.html | 14 ++++++-- layouts/shortcodes/booking.html | 2 +- 7 files changed, 70 insertions(+), 16 deletions(-) create mode 100644 layouts/partials/pagefind-ignore-headings.html diff --git a/assets/sass/booking.scss b/assets/sass/booking.scss index 5889fd073..178403762 100644 --- a/assets/sass/booking.scss +++ b/assets/sass/booking.scss @@ -99,3 +99,17 @@ flex-direction: column; gap: 1rem; } + +.o-booking__content { + h4 { + @extend %h3; + } + + h5 { + @extend %h4; + } + + h6 { + @extend %h5; + } +} diff --git a/assets/sass/headings.scss b/assets/sass/headings.scss index 8d77d7817..92db1fa0d 100644 --- a/assets/sass/headings.scss +++ b/assets/sass/headings.scss @@ -1,4 +1,4 @@ -h1 { +%h1 { font-size: 3rem; line-height: 1.25; margin-bottom: 2rem; @@ -8,7 +8,7 @@ h1 { break-after: avoid; } -h2 { +%h2 { font-size: 2.2rem; line-height: 1.25; margin-bottom: 1rem; @@ -18,7 +18,7 @@ h2 { break-after: avoid; } -h3 { +%h3 { font-size: 2rem; line-height: 1.25; margin-bottom: 1rem; @@ -28,7 +28,7 @@ h3 { break-after: avoid; } -h4 { +%h4 { font-size: 1.8rem; line-height: 1.25; margin-bottom: 1rem; @@ -38,7 +38,7 @@ h4 { break-after: avoid; } -h5 { +%h5 { font-size: 1.6rem; line-height: 1.25; margin-bottom: 1rem; @@ -48,7 +48,7 @@ h5 { break-after: avoid; } -h6 { +%h6 { font-size: 1.4rem; line-height: 1.25; margin-bottom: 1rem; @@ -57,3 +57,27 @@ h6 { text-wrap: balance; break-after: avoid; } + +h1 { + @extend %h1; +} + +h2 { + @extend %h2; +} + +h3 { + @extend %h3; +} + +h4 { + @extend %h4; +} + +h5 { + @extend %h5; +} + +h6 { + @extend %h6; +} diff --git a/assets/sass/trainCategory.scss b/assets/sass/trainCategory.scss index d6b5ed183..6338bb6d2 100644 --- a/assets/sass/trainCategory.scss +++ b/assets/sass/trainCategory.scss @@ -37,14 +37,14 @@ details.o-expander--train-category:not([open]) { .o-train-category__content { h4 { - @extend h3; + @extend %h2; } h5 { - @extend h4; + @extend %h3; } h6 { - @extend h5; + @extend %h4; } } diff --git a/layouts/partials/booking/booking.html b/layouts/partials/booking/booking.html index e76b36229..c90a8e3ec 100644 --- a/layouts/partials/booking/booking.html +++ b/layouts/partials/booking/booking.html @@ -1,4 +1,7 @@ {{- $iconMapping := dict "website" "computer" "phone" "call" "onsite" "person" "email" "mail" "machine" "confirmation_number" "socialmedia" "add_reaction" -}} +
@@ -11,7 +14,7 @@ {{- .subtitle -}}
{{- end }} -
+
{{- $metaFields := slice (dict "key" "reservations" "value" .reservations "label" "booking.reservation") (dict "key" "fip_50" "value" .fip_50 "label" "booking.fip-50") @@ -33,7 +36,7 @@
{{- if and (ne .reservations "nil") (ne .reservations false) .classes -}} -
+
{{ T "booking.reservation-costs" }}: @@ -48,7 +51,7 @@ {{- partial "icon" "keyboard_arrow_down" -}}
-
+
{{- if .info -}}
{{- .info | .original_page.RenderString -}} @@ -68,6 +71,7 @@ > {{- $sectionContent := index $section "content" -}} {{- $sectionFootnotePrefix := print $.page.File.ContentBaseName "-" $sectionName -}} + {{- $sectionContent := partial "pagefind-ignore-headings" (dict "content" $sectionContent) -}} {{- $sectionContent | safeHTML -}}
{{- end -}} diff --git a/layouts/partials/pagefind-ignore-headings.html b/layouts/partials/pagefind-ignore-headings.html new file mode 100644 index 000000000..80970030e --- /dev/null +++ b/layouts/partials/pagefind-ignore-headings.html @@ -0,0 +1,4 @@ +{{- $pattern := `(]*?)?>` -}} +{{- $replacement := `${1}${2} data-pagefind-ignore="index">` -}} +{{- $content := replaceRE $pattern $replacement .content -}} +{{- return $content -}} diff --git a/layouts/partials/train-category.html b/layouts/partials/train-category.html index 7eac14683..5355a4ec3 100644 --- a/layouts/partials/train-category.html +++ b/layouts/partials/train-category.html @@ -3,7 +3,13 @@ name="train-category" id="{{ .id }}" > - + +
{{ $iconMapping := dict @@ -114,9 +120,11 @@
- {{ .content }} + {{- $content := partial "increase-headings" (dict "content" .content "offset" 1) -}} + {{- $content := partial "pagefind-ignore-headings" (dict "content" $content) -}} + {{- $content | safeHTML -}} {{- if or .route_overview_url .additional_information_url -}} -
+
{{- if .route_overview_url -}} {{- partial "button" (dict diff --git a/layouts/shortcodes/booking.html b/layouts/shortcodes/booking.html index ee142ba76..6aef21f74 100644 --- a/layouts/shortcodes/booking.html +++ b/layouts/shortcodes/booking.html @@ -23,6 +23,6 @@ -}} -
+
{{- partial "booking/booking" $params -}}
From a67d1aad1afc6c3deb7bc059601aa5f871863caf Mon Sep 17 00:00:00 2001 From: MoritzWeber0 Date: Sun, 26 Apr 2026 22:42:28 +0200 Subject: [PATCH 2/3] fix: Apply pagefind-ignore on raw content for headings --- layouts/partials/pagefind-ignore-headings.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/pagefind-ignore-headings.html b/layouts/partials/pagefind-ignore-headings.html index 80970030e..cb6bd79fa 100644 --- a/layouts/partials/pagefind-ignore-headings.html +++ b/layouts/partials/pagefind-ignore-headings.html @@ -1,4 +1,4 @@ -{{- $pattern := `(]*?)?>` -}} -{{- $replacement := `${1}${2} data-pagefind-ignore="index">` -}} +{{- $pattern := `(?m)^(#{1,6}\s+.+?)\s*$` -}} +{{- $replacement := `${1} {data-pagefind-ignore="all"}` -}} {{- $content := replaceRE $pattern $replacement .content -}} {{- return $content -}} From a687946ba8a66bea29f631f9d553875f5a4fd4ac Mon Sep 17 00:00:00 2001 From: MoritzWeber0 Date: Sun, 26 Apr 2026 23:01:29 +0200 Subject: [PATCH 3/3] feat: Add increase-headings for booking expanders --- assets/sass/trainCategory.scss | 6 +++--- layouts/shortcodes/booking-section.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/sass/trainCategory.scss b/assets/sass/trainCategory.scss index 6338bb6d2..326dc2497 100644 --- a/assets/sass/trainCategory.scss +++ b/assets/sass/trainCategory.scss @@ -37,14 +37,14 @@ details.o-expander--train-category:not([open]) { .o-train-category__content { h4 { - @extend %h2; + @extend %h3; } h5 { - @extend %h3; + @extend %h4; } h6 { - @extend %h4; + @extend %h5; } } diff --git a/layouts/shortcodes/booking-section.html b/layouts/shortcodes/booking-section.html index 938a2fad5..1abd1d0f0 100644 --- a/layouts/shortcodes/booking-section.html +++ b/layouts/shortcodes/booking-section.html @@ -1,6 +1,6 @@ {{- $content := .Inner -}} {{- $content = partial "helper/resolve-images" (dict "content" $content "page" .Page) -}} -{{- $content = partial "increase-headings" (dict "content" $content "offset" 2) -}} +{{- $content = partial "increase-headings" (dict "content" $content "offset" 3) -}} {{- $sectionName := .Get 0 -}} {{- $footnoteId := print .Page.File.ContentBaseName "-" $sectionName -}} {{- $content = partial "prefix-footnotes" (dict "content" $content "id" $footnoteId) -}}