noindex header code: if original url contains then noindex

Topic summary

A developer needs to prevent search engines from indexing pages containing specific URL parameters, particularly ‘page=’ (pagination) and ‘login_to_shop’.

Current Issue:

  • Despite Shopify automatically creating canonical tags for paginated pages, Google is still indexing them
  • This creates potential duplicate content problems visible in Google Search Console

Attempted Solutions (unsuccessful):

  • {% if url contains 'page=' %} with noindex meta tag
  • if request.path contains
  • if page.url contains

Example URL: Collections page with pagination parameter (?page=3)

Goal: Find the correct Liquid syntax to conditionally add <meta name="robots" content="noindex"> when specific strings appear in the URL. The discussion remains open, seeking a working solution.

Summarized with AI on October 31. AI used: claude-sonnet-4-5-20250929.

we need to noindex pages which contain a specific phrase in the url.

{% if url contains ‘page=’ %} {% endif %}

{% if url contains ‘login_to_shop’ %} {% endif %}

i know that shopify creates canonicals for the ‘page=’ pages directing to the main (non-paginated) url.

however, per google search results and google search console, many of our paginated pages are being indexed causing possible duplicate pages to be indexed.

we have tried “if request.path contains”

we’ve tried “if page.url contains”

sample url:

https://www.finishlinewheels.com/collections/honda-factory-wheels?page=3

even with the canonical these are still getting indexed.

thanks for your help, will give good review to accepted.