Discussion starter: a technical SEO question, posted with an answer from Niraj Raut to open the thread. If you have dealt with this on a site, reply with what you saw, especially where it differs.
- Technical SEO
Filters built as buttons with click handlers rather than anchor links: have you seen Google discover those URLs anyway, and was that good or bad for you?
Disclosure: Niraj Raut, who posted this answer, runs the SEO consultancy linked at the end of it.
1 reply
-
adminAdmin
Google’s documentation says it can generally only crawl links that are anchor elements with an
hrefattribute, so filters built as buttons with click handlers are usually not followed. But Google can still discover filter URLs through other routes: sitemaps, external links, URLs shared by users, URLs that appear as text in the page’s HTML or scripts, and internal links elsewhere on the site. So “Google discovered them anyway” is a common report, and whether it is good or bad depends on your intent. If you wanted certain filter pages indexed, button-based filters hide them and that is bad. If you wanted to keep filter combinations out of the crawl, buttons help, but leaks through other routes create unmanaged crawling that needs a backstop.Decide what you want first
Goal Right implementation Selected filter combinations indexed as landing pages Anchor elements with hrefto clean, stable URLs; self-referencing canonicals; linked from category pagesFilter combinations used by shoppers but not crawled Buttons, or state in URL fragments; plus a robots.txt disallow for the parameter pattern as a backstop Both Anchors for the allowlisted combinations, buttons for the rest, and robots.txt rules for the non-allowlisted pattern How button-based filter URLs leak
- Shared URLs. Shoppers copy filtered URLs into messages, forums and social posts, which crawlers can find.
- Sitemaps generated from the database that include filtered views.
- Other internal links, such as “shop by colour” links in navigation or content that use anchors to filter URLs.
- URLs visible in HTML or scripts, such as in data attributes or JSON, which crawlers may pick up.
- Browser history changes that expose URLs that later appear in analytics or referrer data elsewhere.
Check what is happening on your site
- Search your server logs for Googlebot requests to filter URL patterns. If they appear, discovery is happening.
- Check the Page indexing report for filter URLs under indexed or excluded categories.
- Look for filter URLs receiving impressions in Search Console.
- Trace where discovered URLs came from: sitemaps, internal anchors, external links.
Hypothetical example:
A fashion retailer built all filters as buttons to prevent crawl traps. Logs later show Googlebot requesting thousands of colour and size filter URLs. The source is a “shop by colour” module in the main navigation using anchor links, plus sitemaps generated from all URL variants. Some colour pages rank and convert well; most size combinations are thin. The retailer converts a curated set of colour and category combinations into anchor links with clean URLs, removes other filter URLs from sitemaps, and adds a robots.txt rule for size and sort parameters. Crawling of unwanted filter URLs falls, and the curated colour pages gain rankings.
Watch for this:
Relying on buttons alone as a crawl control is fragile, because a single anchor link somewhere, a sitemap change or an external link can open the pattern up. Add a robots.txt rule for parameter patterns you never want crawled, and check logs periodically.
Choosing which filter combinations deserve links
The allowlist of indexable filter pages should come from evidence: search demand for the combination, inventory depth, conversion data and whether the combination is a concept shoppers recognise, such as “black leather boots” rather than “size 7, sort by newest”. Review it periodically as ranges and demand change. Every combination on the list gets a real link from relevant category pages and a stable URL; everything else stays as a button-driven state or behind the robots.txt rule. That turns the question “did Google find our filters?” into a choice rather than an accident.
Rendering matters as well as markup
Some filter systems render anchor links only after JavaScript runs, or only after a user opens a filter panel. Check the rendered HTML in URL Inspection for your category pages to confirm that the links you want crawled are present without interaction. Links that appear only after a click are, for Google’s purposes, much the same as buttons.
Accessibility and usability matter too
Buttons are correct for actions that change the page state, and links are correct for navigation to a different URL. Filters that behave like navigation, taking the user to a different view with its own URL, are better built as links for accessibility and for users who open them in new tabs. That is another reason to use real links for the filter combinations you want indexed and shareable, and buttons for transient state changes such as sorting and view toggles.
Be deliberate: use anchor links with clean URLs for the filter pages you want indexed, buttons or fragments for everything else, a robots.txt backstop for parameter patterns you never want crawled, and log checks to catch leaks.
Need help with this on your own site?
Niraj Raut works with businesses in Nepal, Australia, the UK, Europe and the US on technical SEO, ecommerce SEO, local SEO and AI search.
Add a reply Cancel reply
Replies are open to approved members. Log in or apply to join.