Hello, why I am getting all my pages duplicated wi...
# kobweb
a
Hello, why I am getting all my pages duplicated with
?_kobwebIsExporting=true
parameter added ? For example you can go on
<http://ayfri.com/|ayfri.com/>
but also
<http://ayfri.com/?_kobwebIsExporting=true/|ayfri.com/?_kobwebIsExporting=true/>
, it will be the exact same page. I don't want these fantom pages to be generated
d
Definitely sounds like a bug. Will investigate in the next day or two.
Just to make sure I'm on the same page, can you explain exactly what you mean by "duplicated"?
a
I tested a bit my website and I deduced that : all pages accept any additionnal query parameter (
?something=something
), but
?_kobwebIsExporting=true
is present when using
context.route
, but in past commits I added canonical URL as the exact
context.route.url
And google registered these pages as the "official" pages, it was a mistake by me But is there any simple way to automatically remove any query parameters ? I can do it myself by always redirecting if any parameter is present (and if I have a page with parameters I will add a custom behavior)
d
I'm not sure I understand. Query parameters are basically user data -- they can be set to anything, and handled or ignored by the page as it wants?
Ah I guess you basically want me to hide my _kobwebIsExporting hack from you
Like even though it is set I shouldn't return it in the list of query parameters?
(This query parameter is set at export time so that users can use
ctx.isExporting
which can be useful)
a
The exact problem is that at one time I registered all the pages with one query parameter as the canonical pages, which is for Google the "real link" of any page It broke a bit the referencing of my website, but it's not a problem, it's my fault However, I'm wondering if there is a simple way to automatically remove any query parameter when going on a route ? With pseudo-code it would look like this
context.route.parameters.clear()
d
What do you mean "when going on a route"?
a
Going on a page
d
I'm sorry I still don't follow.
I'm probably overthinking it
Can you share concrete steps of what's causing you to see the issue?
a
Do not worry about that, it's only a problem for my side, I just need to redirect people going on any page of my website with a query parameter (to the same URL they are actually but without any query parameter)
👍 1
d
I see. You should be able to strip the query parameter and use ctx.router.navigateTo. You might also be able to use a route interceptor here, not sure
Check out the docs for Router.addRouteInterceptor to see if it's a match for you (you may already be aware of the feature)