I have a
In that page, users may use filters to select the products they want to see.
Those filters will work using query strings like:
/products?brands=X,Y&size=1,2 and so on.
I don't want good to index any of the filtered pages. I just need the root
/products crawled and index.
Through my website, Google will not find those query string links, because my filter buttons are just regular HTML buttons that will call
history.push() behind the scenes. So, there are no "visible" links with query strings on my page that Googlebot might find.
Sitemap.xml, only the root
/products will be included of course.
But it's not impossible that one of my users could post my link somewhere on the web like this:
And Googlebot would eventually find out about it, even though I'm not showing it.
So I need a way to block Google from indexing that. What would be the best way of doing that?
Try to add some
robots.txt. Which would not allow Google to crawl my page when there is a query string present?
Let Google crawl it, but render a
noindex meta tag when the page is rendered with active filters (which implies the query string would also be active).
Try to detect (from
user-agent) that a robot is fetching the page
301 redirect it to the root page
/products without the query string.
Let google crawl it and always keep a
rel canonical pointing to the URL
/products without the query string and trust that Google will most likely not index any links with query strings.
Is there a best practice / standard way of doing this?