mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 20:53:24 +10:00
Fix error with trailing slash in listing page URL
This commit is contained in:
parent
1650a87370
commit
84850528cc
1 changed files with 3 additions and 1 deletions
|
|
@ -108,7 +108,9 @@ export const canonicalRoutePath = (routes, location) => {
|
|||
if (isListingRoute) {
|
||||
// Remove the dynamic slug from the listing page canonical URL
|
||||
|
||||
const parts = pathname.split('/');
|
||||
// Remove possible trailing slash
|
||||
const cleanedPathName = pathname.replace(/\/$/, '');
|
||||
const parts = cleanedPathName.split('/');
|
||||
|
||||
if (parts.length !== 4) {
|
||||
throw new Error('Expected ListingPage route to have 4 parts');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue