diff --git a/src/frontend/components/tag-picker.tsx b/src/frontend/components/tag-picker.tsx
index 79fbf02..bd90ad0 100644
--- a/src/frontend/components/tag-picker.tsx
+++ b/src/frontend/components/tag-picker.tsx
@@ -19,15 +19,30 @@ export function TagPicker({ searchParams }: { searchParams?: URLSearchParams })
Tags
{tags.map(tag => {
- const active = selectedTags.includes(tag.urlNormalized)
+ let active = selectedTags.includes(tag.urlNormalized)
+ let hyperlink = `/?tag=${tag.urlNormalized}`;
+
+ for (const existingTag of selectedTags) {
+ hyperlink += `&tag=${existingTag}`
+ }
+
+ // Remove the currently selected tag from the tag link url if applicable
+ if (active) {
+ hyperlink = hyperlink.split(`?tag=${tag.urlNormalized}`).join('')
+ hyperlink = hyperlink.split(`&tag=${tag.urlNormalized}`).join('')
+ }
+
+ // Make sure the hyperlink starts with a ? and not a & (or the root webpage)
+ hyperlink = '/?' + hyperlink.substring(2)
+ if(hyperlink.length == 2) hyperlink = '/'
return (
< li key={tag.name} >
{tag.name}
diff --git a/src/frontend/pages/home.tsx b/src/frontend/pages/home.tsx
index cfcd015..3dce94c 100644
--- a/src/frontend/pages/home.tsx
+++ b/src/frontend/pages/home.tsx
@@ -39,7 +39,7 @@ export function Home({ searchParams }: { searchParams: URLSearchParams }) {
)}
-
+
);
}
@@ -85,7 +85,7 @@ function PostCard({ post }: { post: Post }) {
);
}
-function Pagination({ currentPage, totalPages }: { currentPage: number; totalPages: number }) {
+function Pagination({ currentPage, totalPages, searchParams }:{ currentPage: number; totalPages: number, searchParams: URLSearchParams }) {
// Calculate the range of page numbers to show
let startPage: number;
let endPage: number;
@@ -113,11 +113,17 @@ function Pagination({ currentPage, totalPages }: { currentPage: number; totalPag
const pages = Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i);
+ let passThroughParams = ''
+ searchParams.forEach((val, key) => {
+ if(key != 'page')
+ passThroughParams += `&${key}=${val}`
+ })
+
return (