What's your biggest current challenge? Have your say in Community Polls along the right column.

Duplicate H1 for collection titles

Duplicate H1 for collection titles

Ljvapes
Explorer
107 2 5

Hi all I have run my netpeak spider app and i have a red error "Duplicate H1" and there are over 1000 in there. 

 

I have the below code in the (collection-header.liquid) 

<h1>{{ collection.title | split: '|' | first }}</h1>

 

Is this correct as it looks like the collection titles and everything in them is set to H1 and this maybe causing Duplicate H1 tags?

 

Ljvapes_0-1732724298597.png

 

Replies 3 (3)

EcomGraduates
Shopify Partner
784 68 112

The issue you're encountering is due to the use of <h1> tags for your collection titles in collection-header.liquid. If every collection page, or even individual collection items, has the same <h1> structure, it could lead to duplicate <h1> tags being flagged by SEO tools like Netpeak Spider.  

  • For collection pages: <h1> is appropriate for the main collection title (e.g., the title of the entire category).
  • For product titles or collection items: These should not use <h1> but could use <h2> or <h3> instead.  

 

exmaple 
 {% if forloop.first %}
<h1>{{ collection.title }}</h1>
{% else %}
<h2>{{ collection.title }}</h2>
{% endif %}​

 

 

 


 If this fixed your issue, likes and accepting as a solution are highly appreciated
|  Build an online presence with our custom-built Shopify Theme: EcomifyTheme
|  Check out our reviews: Trustpilot Reviews
|  We are Shopify Partners: EcomGraduates Shopify Partner



Ljvapes
Explorer
107 2 5
Hi thank you very much for the quick response . Is there a way i can edit or amend this ? Any afvise welxome
Ljvapes
Explorer
107 2 5

Good afternoon , Please would you know where i enter the code above that you kindly supplied?

 

below is my collection-header.liquid file 

 

<header class="page-header">
{% if section.settings.display_image_cat %}
<div class="img_cart">
{% if section.settings.img_cat != blank %}
<img src="{{ section.settings.img_cat | img_url :"master"}}" alt="{{ collection.title | split: '|' | first }}" />
{% else %}
{% capture current %}{% cycle 2%}{% endcapture %}
{{ 'lifestyle-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}
{% endif %}
</div>
{% endif %}

{% if settings.enable_multilang %}
<h3>
<span class="lang1">{{ collection.title | split: '|' | first }}</span>
<span class="lang2">{{ collection.title | split: '|' | last }}</span>
</h3>
{% else %}
<h1>{{ collection.title | split: '|' | first }}</h1>
{% endif %}

{% if collection.description != '' %}
<div class="collection-des">
{% if settings.enable_multilang %}
<div class="rte lang1">{{ collection.description | split: '[lang2]' | first }}</div>
<div class="rte lang2">{{ collection.description | split: '[lang2]' | last }}</div>
{% else %}
<div class="rte">{{ collection.description | split: '[lang2]' | first }}</div>
{% endif %}
</div>
{% endif %}
</header>
{% schema %}
{
"name": "Collection Header",
"settings": [
{
"type": "checkbox",
"id": "display_image_cat",
"label": "Display Image Category?",
"default": true
},
{
"type": "image_picker",
"id": "img_cat",
"label": "Image Category"
}
]
}
{% endschema %}