{"title":"Maintain SEO for filterable store pages","slug":"liquid-how-to-show-canonical-content","url":"https://support.storeconnect.com/articles/liquid-how-to-show-canonical-content","url_markdown":"https://support.storeconnect.com/articles/liquid-how-to-show-canonical-content.md","subtitle":null,"summary":"Prevent duplicate page indexing caused by sort and filter URL parameters. Use the current_request Liquid variable to set canonical URLs and show conditional content based on query strings.","type":"Help_Documentation","video_url":"","keywords":"canonical url, seo, duplicate content, liquid, current_request, query string, url parameters, filter pages, sort parameters, conditional content, search engine optimization, filterable pages","last_modified":"2026-08-21T07:12:35+0000","body_markdown":"Search engines treat pages with unique URLs as unique pages. And unique pages rank lower in SEO than consistently found pages. \n\nThis is especially problematic for ecommerce sites where it is common to filter or sort page content, adding URL metadata making it seem like a new page. For instance a product category page might be accessed this way, adding query parameters to the url, e.g. `?sort=price\u0026page=3`\n\nThis can result in lower SEO rankings because the same content is being displayed on what are considered different pages.\n\n## The solution\n\nYou can use a global variable to tell search engines to ignore the extra metadata in the URL.\n\n### The `current_request` global variable\n\nOne of the global variables you can use in your liquid code is `current_request`.\n\nIt will return a [Request - Liquid Object Reference](request-liquid-object-reference) object that provides some information about the how the page was accessed (requested). You can check the documentation for all the attributes it offers, but for now we are just going to use these three:\n\n-   fullpath: this returns the whole of the url after the domain, eg `/products?page=3`\n-   path: this returns the url after the domain and up to the “?”, eg `/products`\n-   query\\_string: this returns everything after “?” if there is one, eg `page=3`\n\nIf your page was accessed with any query parameters you might want to show some different content. Here are a few ways to do this:\n\n#### Using `fullpath`\n\n\n```\n{% if current_request.fullpath == \"/current-offers\" %}\n  This content will show if there the full path exactly matches \"/current-offers\"\n  This will not match: \"/current-offers?sort=price\"\n{% else %}\n  This content will show in all other circumstances\n{% endif %}\n```\n\n\n#### Using `query_string`\n\n\n```\n{% if current_request.query_string == \"\" %}\n  This content will show if there are no query parameters\n{% else %}\n  This content will show if the page was requested with query parameters\n{% endif %}\n```\n\n\n#### Using a combination of `path` and `query_string`\n\nThis method is useful if you want to change the content based on what query parameters were used.\n\n\n```\n{% if current_request.path == \"/current-offers\" %}\n  We know we're on the Current Offers page\n  We don't yet know if it was accessed with query parameters\n\n  {% if current_request.query_string != \"\"  %}\n    Ok so the page was accessed with query params\n\n    {% assign params = current_request.query_string | prepend: \"\u0026\" %}\n\n    {% if params contains \"\u0026page=\" %}\n      The page was accessed with the query parameter: page!\n    {% elsif params contains \"\u0026sort=\" %}\n      The page was accessed with the query parameter sort!\n    {% else %}\n      The page was accessed with some other query parameters! ¯\\_(ツ)_/¯\n    {% endif %}\n  {% else %}\n    The page was not accessed with any query parameters\n  {% endif %}\n{% endif %}\n```\n"}