The problem with query parameters is that sometimes they make the same page look like two more than one page, with "duplicate content". This is not ideal from an SEO point of view.

Let's say we have the "About" page and this contains a WebApp which can be searched.

We have the main URL:

/about

but search engines have incorrectly identified other URLS:

/about?keyword=hello%20world
/about?keyword=hello%20mars


In your Page Template in the <head> you can set a recommendation that query parameters should be ignored when it comes to SEO. You can do this by setting the main part of the URL as the canonical URL. In this example, this will be applied site-wide, but you may wish to use an if statement to only apply it on certain pages.

<head>
  <!-- Stops Search Engines treating the same page with different URL parameters as duplicate pages -->
<link rel="canonical" href="{{context.headers.PATH_INFO}}">
</head>


In the example, we use the "context.headers" object to read the URL of the page, specifically the "PATH_INFO" which excludes query parameters, but includes slugs. This means you don't need to change this for each page- the liquid dynamically works out the current URL without query parameters. You can (and should) adjust this based on your site's structure and SEO needs.



Did this answer your question?