Skip to content

Commit 557454c

Browse files
committed
coaching pagina
1 parent 9c1d6ae commit 557454c

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed

content/coaching/_.en._.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "not found"
3+
img: "_.jpg"
4+
alt: ""
5+
volgnummer: ""
6+
---
7+
8+
# The requested page could not be found

content/coaching/_.jpg

26.4 KB
Loading

content/coaching/_.nl._.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "niet gevonden"
3+
img: "_.jpg"
4+
alt: ""
5+
volgnummer: ""
6+
---
7+
8+
# De gevraagde pagina kon niet worden gevonden

src/routes/coaching/+page.svelte

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { onMount } from 'svelte';
33
import type { CoachingModule, ImageModule, Coaching } from '$lib/types';
4-
4+
import { languageTag } from '$lib/paraglide/runtime.js';
55
const imageModules = import.meta.glob(
66
'$content/coaching/*.{avif,gif,heif,jpeg,jpg,png,tiff,webp,svg}',
77
{
@@ -12,12 +12,24 @@
1212
}
1313
) as Record<string, ImageModule>;
1414
15-
const coachingModules = import.meta.glob('$content/coaching/*.nl.md', {
15+
const coachingModulesNl = import.meta.glob('$content/coaching/*.nl.md', {
1616
eager: true,
1717
query: {
1818
enhanced: true
1919
}
2020
}) as Record<string, CoachingModule>;
21+
const coachingModulesEn = import.meta.glob('$content/coaching/*.en.md', {
22+
eager: true,
23+
query: {
24+
enhanced: true
25+
}
26+
}) as Record<string, CoachingModule>;
27+
28+
const coachingModulesMap = {
29+
en: coachingModulesEn,
30+
nl: coachingModulesNl
31+
};
32+
const coachingModules = coachingModulesMap[languageTag()];
2133
2234
let coachings: Coaching[] = [];
2335

src/routes/coaching/[coaching_title]/+page.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
import { fetchContent } from '$lib/utils';
2+
import { languageTag } from '$lib/paraglide/runtime.js';
23

3-
export async function load({ params }) {
4-
const post = await import(`$content/coaching/${params.coaching_title}.md`);
4+
export async function load({ depends, params }) {
5+
depends("paraglide:lang");
6+
7+
let post;
8+
try {
9+
post = await import(`$content/coaching/${params.coaching_title}.${languageTag()}.md`);
10+
} catch (error) {
11+
post = await import(`$content/coaching/_.${languageTag()}._.md`);
12+
}
513
const { title, date, img } = post.metadata;
614
const content = post.default;
715

8-
const allPosts = await fetchContent('coaching');
16+
const allPosts = await fetchContent('coaching', languageTag());
917
const sortedPosts = allPosts.sort((a, b) => a.meta.volgnummer - b.meta.volgnummer);
1018

1119
const currentIndex = sortedPosts.findIndex((p) => p.path === params.coaching_title);
@@ -24,7 +32,7 @@ export async function load({ params }) {
2432

2533
/** @type {import('./$types').EntryGenerator} */
2634
export async function entries() {
27-
const allPosts = await fetchContent('coaching');
35+
const allPosts = await fetchContent('coaching', languageTag());
2836
return allPosts.map((post) => ({ coaching_title: post.path }));
2937
}
3038

0 commit comments

Comments
 (0)