Skip to content

Commit a2eb8b2

Browse files
committed
fix: language picker
1 parent 04577af commit a2eb8b2

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

public/favicon.svg

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/components/LanguagePicker.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
import { defaultLang, languages } from "../i18n/ui";
3-
import { getEntry } from "astro:content";
3+
import { getCollection, getEntry } from "astro:content";
44
import {
55
getLangFromUrl,
66
useTranslatedPath,
@@ -22,12 +22,12 @@ let post = null;
2222
const translatedPostSlugs: Partial<typeof languages> = {};
2323
2424
try {
25-
post = await getEntry("posts", postSlug);
25+
post = await getEntry("posts", postSlug.replace(/\/+$/, ""));
2626
post!.data.translatedPosts?.forEach((tp) => {
2727
const [language, slug] = tp.translatedPost.slug.split("/");
2828
translatedPostSlugs[language as keyof typeof languages] = slug;
2929
});
30-
} catch {
30+
} catch (e){
3131
post = null;
3232
}
3333
---

0 commit comments

Comments
 (0)