Skip to content

Commit 48de357

Browse files
feat: backlinks from booking page (#468)
- added index "booking" to all operator pages - modified related-partial - added backlinks from booking page to operator page Because the index is on the operator pages, we need an different logic for related-partial than before. --------- Co-authored-by: MoritzWeber0 <[email protected]>
1 parent 531d988 commit 48de357

File tree

8 files changed

+45
-13
lines changed

8 files changed

+45
-13
lines changed

assets/sass/contentNavigation.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@
196196
}
197197
}
198198

199-
main.o-newspage .o-aside {
199+
main.o-newspage .o-aside,
200+
main.o-bookingpage .o-aside {
200201
display: none;
201202
}
202203
}

assets/sass/styles.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ body {
1919
}
2020
}
2121
@media (max-width: #{$breakpoint-lg}) {
22-
body:has(article.o-single--with-sidemenu):not(:has(.o-newspage)) {
22+
body:has(article.o-single--with-sidemenu):not(:has(.o-newspage)),
23+
body:has(article.o-single--with-sidemenu):not(:has(.o-bookingpage)) {
2324
margin: 0 0 calc(7rem + env(safe-area-inset-bottom)) 0;
2425
}
2526
}

i18n/de.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ news-headline: Was gibt's Neues?
8282
news-other: Weitere News
8383
operators_without_fip: Betreiber ohne FIP
8484
related:
85+
booking: Bei diesen Betreibern nutzbar
8586
countries: Verwandte Länder
8687
news: Verwandte News
8788
operators: Verwandte Betreiber

i18n/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ news-headline: What's new?
8181
news-other: Other News
8282
operators_without_fip: Operators without FIP
8383
related:
84+
booking: Usable with these operators
8485
countries: Related Countries
8586
news: Related News
8687
operators: Related Operators

i18n/fr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ news-headline: Quoi de neuf ?
8181
news-other: Autres actualités
8282
operators_without_fip: Opérateurs sans FIP
8383
related:
84+
booking: Utilisable avec ces opérateurs
8485
countries: Pays associés
8586
news: Actualités associées
8687
operators: Opérateurs associés

layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
id="content"
1414
class="{{ if .IsHome }}o-startpage{{ end }}{{ if eq .Page.Type "news" }}
1515
o-newspage
16-
{{ end }}"
16+
{{ end }}{{ if eq .Page.Type "booking" }}o-bookingpage{{ end }}"
1717
>
1818
<div class="o-container">
1919
{{ if not .IsHome }}

layouts/booking/single.html

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
{{ define "main" }}
2-
<article data-pagefind-ignore class="o-single o-card">
3-
<div class="o-single__header">
4-
<h1>{{ .Title }}</h1>
5-
</div>
2+
<article data-pagefind-ignore class="o-single o-single--with-sidemenu">
3+
<aside id="aside" class="o-aside">
4+
<div class="o-single__container">
5+
{{ partial "related" (dict "index" "booking" "title" (T "related.booking") "page" . "identifier" "booking") "pageType" "booking" }}
6+
<hr aria-hidden="true" />
7+
{{ partial "link"
8+
(dict
9+
"Destination" (print .Site.Params.githubDevUrl "blob/main/content" .Path "/index." .Language ".md")
10+
"Text" ((print (partial "icon" "edit_square") (T "editPage")) | .Page.RenderString)
11+
)
12+
}}
13+
</div>
14+
</aside>
15+
<div class="o-single__container">
16+
<div class="o-single__header">
17+
<h1>{{ .Title }}</h1>
18+
</div>
619

7-
<div class="o-single__content">
8-
{{ .Content }}
9-
</div>
20+
<div class="o-single__content">
21+
{{ .Content }}
22+
</div>
1023

11-
{{ partial "booking-links" . }}
24+
{{ partial "booking-links" . }}
25+
</div>
1226
</article>
1327
{{ end }}

layouts/partials/related.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
{{ $pageType := .pageType | default .index }}
2-
{{ $related := where (.page.Site.RegularPages.RelatedIndices .page .index) ".Page.Type" $pageType }}
2+
{{ $related := "" }}
3+
4+
{{ if eq $pageType "booking" }}
5+
{{ $related = slice }}
6+
{{ $searchPattern := printf "booking id=\"%s\"" .page.File.ContentBaseName }}
7+
{{ range where .page.Site.RegularPages "Type" "operator" }}
8+
{{ if in .RawContent $searchPattern }}
9+
{{ $related = $related | append . }}
10+
{{ end }}
11+
{{ end }}
12+
{{ else }}
13+
{{ $related = where (.page.Site.RegularPages.RelatedIndices .page .index) ".Page.Type" $pageType }}
14+
{{ end }}
15+
316
{{ if gt (len $related) 0 }}
417
<h3 id="o-related__title-{{ .identifier }}">{{ .title }}</h3>
518
<ul
@@ -11,7 +24,7 @@ <h3 id="o-related__title-{{ .identifier }}">{{ .title }}</h3>
1124
{{ $text := .LinkTitle }}
1225
{{ if eq .Page.Type "news" }}
1326
{{ $text = print (partial "icon" "newspaper") $text }}
14-
{{ else if eq .Page.Type "operator" }}
27+
{{ else if or (eq .Page.Type "operator") (eq .Page.Type "booking") }}
1528
{{ $text = print (partial "operator-logo" (dict "operator" .File.ContentBaseName)) $text }}
1629
{{ else if eq .Page.Type "country" }}
1730
{{ $text = print (partial "flag" (dict "country" .File.ContentBaseName)) $text }}

0 commit comments

Comments
 (0)