question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fully dynamic product URL leads to 404 for other pages that matches the number of URL params/segments

See original GitHub issue

Environment Details

  • Spartacus: 1.4
  • Browser: Chrome
  • OS: Mac

Steps to Reproduce

Configure the product route to be fully dynamic like so

ConfigModule.withConfig({
    routing: {
        routes: {
            product: {
                paths: [
                    ':category/:name/:productCode',
                ]
            }
        }
    }
})

Observed Results

Any URL that has 3 segments is considered by Spartacus as a product page even when they are not.

For example, the following routes will result in a 404 because Spartacus thinks they are all product pages.

URL Actual Expected
/category/bags/shoulder-bags 404 Category Page
/cmspage/string/random 404 Content Page
/store-finder/country/US 404 Store Locator

Expected Results

There should be a way to have more specific route matchers.

At a minimum, there should be documentation guideline that having a fully dynamic URL is not possible or recommended.

Offer to Fix

No

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kbalagtey-workcommented, Feb 21, 2020

Thanks, @plabadie ,

I’m glad to see that you are already working on this feature planned for 2.0.

Our use case is 1 & 3.

For 1, we will make use of the workaround you provided while we wait for the proper solution that will come with 2.0.

For 3, I was thinking of a similar solution to solve our issue relating to duplicate pages

0reactions
kbalagtey-workcommented, Apr 29, 2020

Understood, thanks @Platonn for the write-up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic URL Parameters + Woocommerce create 404 errors
Hi Guys, Our latest Moz crawl shows a lot of 404-errors for pages that create dynamical links for users? (I guess it are...
Read more >
React-router URLs don't work when refreshing or writing ...
But that would give 404 errors for all other URLs when requested from the server. Those same URLs work fine on the client-side,...
Read more >
Page Indexing report - Search Console Help - Google Support
View data about indexed pages link shows historical information about your indexed page count, as well as an example list of up to...
Read more >
ASP.NET Core Blazor routing and navigation - Microsoft Learn
An Id route segment is present in the request URL. The Id segment is an integer ( int ) type. Pages/User.razor : razor...
Read more >
URL Canonicalization and the Canonical Tag | Documentation
What is a canonical URL? A canonical URL is the URL of the page that Google thinks is most representative from a set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found