Skip to content

Commit 359f511

Browse files
committed
feat: Updated the “Contact your regulators.” link to use the current locale’s CTA path
1 parent ec959b1 commit 359f511

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/layouts/Landing.astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ const daysLeft = Math.max(0, Math.ceil((deadline.getTime() - now.getTime()) / (1
6262
6363
const ctaPath = locale === 'en' ? '/cta/' : `/${locale}/cta/`;
6464
const homePath = locale === 'en' ? '/' : `/${locale}/`;
65+
66+
/** Rewrite /cta/#consumers to the active locale CTA path. */
67+
function localizeCtaLinks(html: string): string {
68+
return html.replace(/href="\/cta\/#consumers"/g, `href="${ctaPath}#consumers"`);
69+
}
6570
---
6671
<Base title={t.title} lang={locale} description={t.description}>
6772
{/* Head slot: pages can inject scripts (e.g. the redirect script) */}
@@ -174,7 +179,7 @@ const homePath = locale === 'en' ? '/' : `/${locale}/`;
174179
<h3 id="everyone" set:html={t.act_everyone_heading} />
175180
<ul>
176181
<li set:html={t.act_fdroid} />
177-
<li set:html={t.act_regulators} />
182+
<li set:html={localizeCtaLinks(t.act_regulators)} />
178183
<li set:html={t.act_share} />
179184
<li set:html={t.act_astroturf} />
180185
<li set:html={t.act_petition} />

0 commit comments

Comments
 (0)