my website at ewancroft.uk
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: normalise tags

+3 -3
+2 -2
src/lib/helper/posts.ts
··· 77 77 } 78 78 79 79 /** 80 - * Extract all unique tags from posts 80 + * Extract all unique tags from posts (normalized to lowercase) 81 81 */ 82 82 export function getAllTags(posts: BlogPost[]): string[] { 83 83 const tagsSet = new Set<string>(); 84 84 posts.forEach((post) => { 85 - post.tags?.forEach((tag) => tagsSet.add(tag)); 85 + post.tags?.forEach((tag) => tagsSet.add(tag.toLowerCase())); 86 86 }); 87 87 return Array.from(tagsSet).sort(); 88 88 }
+1 -1
src/routes/archive/+page.svelte
··· 90 90 const filteredPosts = $derived.by(() => { 91 91 if (!selectedTag) return filteredByPublication; 92 92 return filteredByPublication.filter((post: BlogPost) => { 93 - return post.tags?.includes(selectedTag); 93 + return post.tags?.some((tag) => tag.toLowerCase() === selectedTag.toLowerCase()); 94 94 }); 95 95 }); 96 96