.atom URLs Solution 1 - block through robots.txt
This is the easiest, but not 100% efficient solution. We’d advise implementing it, only if you don't have many problematic pages. You will need to edit your robots.txt on Shopify by adding the following code to it:
User-agent: *
Disallow: *.atom
This code tells all search bots not to crawl .atom URLs, however, Google may still prefer to index those!
Your final code should look approximately like this:
# we use Shopify as our ecommerce platform
{%- comment -%}
# Caution! Please read https://help.shopify.com/en/manual/promoting-marketing/seo/editing-robots-txt before proceeding to make changes to this file.
{% endcomment %}
{% for group in robots.default_groups %}
{{- group.user_agent -}}
{% for rule in group.rules %}
{{- rule -}}
{% endfor %}
{%- if group.user_agent.value == '*' -%}
{{ 'Disallow: /*?q=*' }}
{{ 'Disallow: /*/sandbox/*' }}
{{ 'Disallow: /*.atom' }}
{{ 'Disallow: /*.oembed' }}
{%- endif -%}
{%- if group.sitemap != blank -%}
{{ group.sitemap }}
{%- endif -%}
{% endfor %}
This code also takes care of a few similar SEO issues with Shopify, such as search URLs being crawled.
.atom URLs Solution 2 - removing URLs
This is a more radical solution that removes the URLs completely. This code snippet works by capturing all content for the header, identifying .atom URLs, and removing them from the header. However, it's important to note that while effective, this method is considered somewhat unconventional and may have limitations in the long term.
Editing the content_for_header is frowned upon, as future updates from Shopify could potentially impact its functionality. If Shopify alters how this tag operates, it could affect the website's behaviour in the future, so create backups and do regular checks.
Users seeking to remove .atom URLs from their Shopify stores can consider implementing a liquid code solution. The provided code snippet can be added to the theme files to address this issue.
Find {{ content_for_header }} in theme.liquid and replace it with:
{% capture cfh %}
{{ content_for_header }}
{% endcapture %}
{% assign clnurl = canonical_url | split: "?" | first | remove: shop.secure_url | join | string %}
{% assign atomurl = '<link rel="alternate" type="application/atom+xml" title="Feed" href="' | append: clnurl | append: '.atom" />' %}
{% if cfh contains "application/atom+xml" %} <!-- {{ atomurl | string }} -->
{% endif %}
{{ cfh | remove: atomurl }}
3. Validate your .atom URLs fix with Search Console
Whilst technically this doesn't solve the problem, we recommend doing it after implementing one of the solutions above. After you have implemented your solution, go to Search Console and "Validate your fix" to ensure Google knows about the changes you made.