Skip to content

Commit

Permalink
try replace member [slug] with [name=name]
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamDiakite committed Oct 16, 2023
1 parent c21a4e2 commit 740e8b5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/lib/components/Nav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
const getUrl = (name: string) => {
if ($page.route.id?.includes('news') || $page.route.id?.includes('projects'))
return `${$rt(`route.${name}`)}`;
else return `${$rt(`route.${name}`)}${$page.params.slug ? '/' + $page.params.slug : ''}`;
else if ($page.route.id?.includes('memb')) {
return `${$rt(`route.${name}`)}/${$page.params.name}`;
} else return `${$rt(`route.${name}`)}${$page.params.slug ? '/' + $page.params.slug : ''}`;
};
if (route.includes('home')) url = `${$rt('route.home')}`;
Expand Down
13 changes: 13 additions & 0 deletions src/params/name.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ParamMatcher } from '@sveltejs/kit';

export const match = ((param) => {
return param === 'AliceTruc' ||
param === 'emchateau' ||
param === 'gdJESS' ||
param === 'ktanton' ||
param === 'LeaMaronet' ||
param === 'lenamk' ||
param === 'talithamotter' ||
param === 'williamdiakite' ||
param === 'ZoeRenaudie'
}) satisfies ParamMatcher
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fetchData } from '$lib/helpers/data.js'

export const load = async ({ params }) => {
const members = await fetchData('team')
const member = members.filter(member => member.meta.slug === params.slug)
const member = members.filter(member => member.meta.slug === params.name)
return {
member
}
Expand Down

0 comments on commit 740e8b5

Please sign in to comment.