Sitecore JSS - Nextjs - Redirect problem using "router.push" with url that contains query
This wont be a solution for a problem, but will be a inner discussion about some things that doest work. If I found a proper solution, I will update the post and add the solution once I found it.
I will add the resources found that I think are usefull. To understand the problem.
Not sure if it is the best implementation we can get. But when try to use a Url that contains paramenters like
/Search/Blogs/result?types=news&q=
The main problem with this implementation is the URL came from a Sitecore GeneralLink as a External link. The nextjss "router.push" allow to call URL query, but it must be implemented in that way. The problem with "General Link" contains a link to an object internal or external. In case we use a external link we can put there any link we want. In this example I use a link like:
/Search/Blogs/result?types=news&structure=
But when router.push tries to resolve this link, it will probably redirect to a
/Search/Blogs/result%3Fq=&types=news
So some characters are translated, to be exact the question mark "?" to "%3F". So the redirection wont work properly.
For now, I fixed the current problem using a "<a>" html link with a button appearance.
Comments
Post a Comment