support dynamic content on PLP

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe
2024-07-07 15:05:15 +07:00
parent 0fb7d0d3e5
commit ebbc8f053c
13 changed files with 211 additions and 9 deletions

1
lib/types.ts Normal file
View File

@@ -0,0 +1 @@
export type SearchParams = { [key: string]: string | string[] | undefined };

View File

@@ -145,7 +145,7 @@ export const isBeforeToday = (date?: string | null) => {
};
export const getCollectionUrl = (handle: string, includeSlashPrefix = true) => {
const rewriteUrl = handle.split('_').filter(Boolean).join('/');
const rewriteUrl = handle.split('_').filter(Boolean).join('/').toLowerCase();
return includeSlashPrefix ? `/${rewriteUrl}` : rewriteUrl;
};