Skip to content

Commit bb46bfb

Browse files
committed
fix: correct en/de routing for navigation and project cards
1 parent d2cdec4 commit bb46bfb

File tree

2 files changed

+44
-16
lines changed

2 files changed

+44
-16
lines changed

_data/partners.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
},
130130
"buttons": {
131131
"info": "https://coli-conc.gbv.de/coli-ana/",
132-
"start": "https://coli-conc.gbv.de/coli-ana/"
132+
"start": "https://coli-conc.gbv.de/coli-ana/app/"
133133
}
134134
},
135135
{

en/_includes/projects.md

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
</div>
1111

1212
<div class="cards-row">
13+
14+
{% set prefix = "/de" if locale == "de" else "" %}
15+
1316
{# Loop through the partners.projects array. The variable "partner" represents the current project item. #}
1417
{% for partner in partners.projects %}
18+
1519
{# Insert section heading before the 4th project #}
1620
{% if loop.index == 4 %}
1721
<div class="related-services-section">
@@ -24,49 +28,70 @@
2428
{# Localize partner text/description and prepare a clean URL for later use in the template #}
2529
{% set text = partner.text | localize %}
2630
{% set description = partner.description | localize %}
27-
{% set partner_url = partner.url | url %}
31+
32+
{# Localize coli-conc pages: EN => /..., DE => /de/... #}
33+
{% if partner.url and partner.url.startsWith("https://coli-conc.gbv.de/") %}
34+
{% set path = partner.url | replace("https://coli-conc.gbv.de", "") %}
35+
{% set partner_url = prefix ~ path %}
36+
{% else %}
37+
{% set partner_url = partner.url %}
38+
{% endif %}
2839

2940
{# Helper variable for the title conditional below #}
3041
{% set text_norm = (text | string | trim | lower) %}
3142

32-
{# Render title with special handling for "Metadata / Vocabulary Hosting Services" #}
3343
<div class="project-card-header">
3444
{% if text|trim == "Metadata / Vocabulary Hosting Services" %}
3545
<span class="project-card-title font-size-large">{{ text }}</span>
3646
{% else %}
37-
<a href="{{ partner_url }}" class="project-card-title font-size-large">
38-
{{ text }}
39-
</a>
47+
<a href="{{ partner_url }}" class="project-card-title font-size-large">
48+
{{ text }}
49+
</a>
4050
{% endif %}
4151
</div>
4252

4353
{# Prepare and render project action buttons #}
4454
{% set btns = partner.buttons %}
4555

46-
{# Render action buttons if button data is available.
47-
Each button (Info / Start) is rendered only if its URL exists.
48-
#}
4956
{% if btns %}
5057
<div class="project-card-actions">
58+
59+
{# Info button: localize coli-conc pages, but keep /app/ links unchanged #}
5160
{% if btns.info %}
52-
<a href="{{ btns.info }}" class="button">Info</a>
61+
{% if "/app/" in btns.info %}
62+
<a href="{{ btns.info }}" class="button">Info</a>
63+
{% elif btns.info.startsWith("https://coli-conc.gbv.de/") %}
64+
{% set infoPath = btns.info | replace("https://coli-conc.gbv.de", "") %}
65+
<a href="{{ prefix ~ infoPath }}" class="button">Info</a>
66+
{% else %}
67+
<a href="{{ btns.info }}" class="button">Info</a>
68+
{% endif %}
5369
{% endif %}
70+
71+
{# Start button: keep /app/ links unchanged, localize other coli-conc pages #}
5472
{% if btns.start %}
55-
<a href="{{ btns.start }}" class="button">Start</a>
73+
{% if "/app/" in btns.start %}
74+
<a href="{{ btns.start }}" class="button">Start</a>
75+
{% elif btns.start.startsWith("https://coli-conc.gbv.de/") %}
76+
{% set startPath = btns.start | replace("https://coli-conc.gbv.de", "") %}
77+
<a href="{{ prefix ~ startPath }}" class="button">Start</a>
78+
{% else %}
79+
<a href="{{ btns.start }}" class="button">Start</a>
80+
{% endif %}
5681
{% endif %}
82+
5783
</div>
5884
{% endif %}
5985

60-
{# Render the localized project description #}
6186
<p class="project-card-description">{{ description }}</p>
6287

6388
{# Render project-specific related links based on project type #}
6489
{% if partner_url and ("cocoda" in partner_url) %}
6590
<ul class="project-card-list">
66-
<li><a href="https://coli-conc.gbv.de/cocoda/">Cocoda</a></li>
67-
<li><a href="https://coli-conc.gbv.de/terminologies/">KOS Registry</a></li>
68-
<li><a href="https://coli-conc.gbv.de/concordances/">Concordance Registry</a></li>
69-
<li><a href="https://coli-conc.gbv.de/ccmapper/">CCMapper</a></li>
91+
<li><a href="{{ prefix ~ '/cocoda/' }}">Cocoda</a></li>
92+
<li><a href="{{ prefix ~ '/terminologies/' }}">KOS Registry</a></li>
93+
<li><a href="{{ prefix ~ '/concordances/' }}">Concordance Registry</a></li>
94+
<li><a href="{{ prefix ~ '/ccmapper/' }}">CCMapper</a></li>
7095
</ul>
7196
{% elif "vocabulary hosting services" in (text | string | lower) %}
7297
<ul class="project-card-list">
@@ -97,7 +122,10 @@
97122
>
98123
</div>
99124
{% endif %}
125+
100126
</div>
127+
101128
{% endfor %}
129+
102130
</div>
103131
</div>

0 commit comments

Comments
 (0)