Skip to content

Commit ff47ba6

Browse files
Update landing page url to include language (#590)
1 parent 8e472c3 commit ff47ba6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/pages/HomePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ const HomePage = () => {
198198
<Link
199199
color="brand.600"
200200
textDecoration="underline"
201-
href={landingPageUrl()}
201+
href={landingPageUrl(languageId)}
202202
>
203203
{children}
204204
</Link>

src/utils/external-links.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ const microbitOrgBaseUrl =
1212
? "https://microbit.org/"
1313
: "https://stage.microbit.org/";
1414

15+
const langPath = (languageId: string) =>
16+
languageId === "en" ? "" : `${languageId.toLowerCase()}/`;
17+
1518
export const projectUrl = (slug: string, language: string) =>
16-
`${microbitOrgBaseUrl}${
17-
language === "en" ? "" : `${language.toLowerCase()}/`
18-
}projects/make-it-code-it/${encodeURIComponent(slug)}/`;
19+
`${microbitOrgBaseUrl}${langPath(
20+
language
21+
)}projects/make-it-code-it/${encodeURIComponent(slug)}/`;
1922

2023
export const userGuideUrl = () =>
2124
`${microbitOrgBaseUrl}get-started/user-guide/microbit-createai/`;
2225

23-
export const landingPageUrl = () => `${microbitOrgBaseUrl}ai/`;
26+
export const landingPageUrl = (language: string) =>
27+
`${microbitOrgBaseUrl}${langPath(language)}ai/`;

0 commit comments

Comments
 (0)