Have your say in Community Polls: What was/is your greatest motivation to start your own business?

How can I change category titles from H3 to H1 on a Gecko theme site?

Solved

How can I change category titles from H3 to H1 on a Gecko theme site?

Petpower
Excursionist
17 0 2

Hello everyone. So we recently did a seo score check on our site, and for some reasons there are no categories that have H1s. For some reason they are all set as H3s. so i'm trying to fix it, but can't find what i should do to change it.  i have gone into the code on my site but i have no coding experience so i wont even know where to start! can some one please help and guide me to getting it fixed, it would be greatly appreciated!!

 

Site is https://petpower.dk/
We use gecko theme

Accepted Solution (1)

TerenceKEANE
Shopify Partner
512 86 79

This is an accepted solution.

Hi,

What you're requesting involves modifications to the software's back-end. This is typically not straightforward in most software and requires manual code changes. Fortunately, it seems like today is your lucky day 😉 I've written a JavaScript code for you that will exclusively work on the "collections" pages and replace all h3 elements with h1 elements within the specified area. If you encounter any issues again, feel free to write, I'll help.

 

1) Navigate to the 'Edit Code' option in your theme settings, then search for 'theme.liquid' in the search bar.

2) Paste the following code below the '<head>' tag. Please refer to the attached screenshot for guidance.

 

 

<script>

if (window.location.href.indexOf('/collections/') > -1) {
    var sectionTitles = document.querySelectorAll('.t4s-section-title');
    
    sectionTitles.forEach(function(sectionTitle) {
        var newHeading = document.createElement('h1');
        newHeading.textContent = sectionTitle.textContent;
        sectionTitle.parentNode.replaceChild(newHeading, sectionTitle);
    });
}

</script>

 

 

Terence.

★ Looking for Dedicated Premium Coding Support? Join our unique "PREMIUM SUPPORT" service starting at 59 USD for 1 MONTH!
★ Get skilled Shopify developers at BUDGET-FRIENDLY RATES — explore Novajetsoft.com for a rapid quote!
If my support was a lifeline for you, The COFFEE  
would be the anchor keeping me steady!
★ For Quick response --> WhatsApp | Email --> info@novajetsoft.com | Software Engineer - Specializing In Advanced E-Commerce Websites

View solution in original post

Replies 8 (8)

TerenceKEANE
Shopify Partner
512 86 79

This is an accepted solution.

Hi,

What you're requesting involves modifications to the software's back-end. This is typically not straightforward in most software and requires manual code changes. Fortunately, it seems like today is your lucky day 😉 I've written a JavaScript code for you that will exclusively work on the "collections" pages and replace all h3 elements with h1 elements within the specified area. If you encounter any issues again, feel free to write, I'll help.

 

1) Navigate to the 'Edit Code' option in your theme settings, then search for 'theme.liquid' in the search bar.

2) Paste the following code below the '<head>' tag. Please refer to the attached screenshot for guidance.

 

 

<script>

if (window.location.href.indexOf('/collections/') > -1) {
    var sectionTitles = document.querySelectorAll('.t4s-section-title');
    
    sectionTitles.forEach(function(sectionTitle) {
        var newHeading = document.createElement('h1');
        newHeading.textContent = sectionTitle.textContent;
        sectionTitle.parentNode.replaceChild(newHeading, sectionTitle);
    });
}

</script>

 

 

Terence.

★ Looking for Dedicated Premium Coding Support? Join our unique "PREMIUM SUPPORT" service starting at 59 USD for 1 MONTH!
★ Get skilled Shopify developers at BUDGET-FRIENDLY RATES — explore Novajetsoft.com for a rapid quote!
If my support was a lifeline for you, The COFFEE  
would be the anchor keeping me steady!
★ For Quick response --> WhatsApp | Email --> info@novajetsoft.com | Software Engineer - Specializing In Advanced E-Commerce Websites
Petpower
Excursionist
17 0 2

Hey Terence, Thank you very much😍  i have tried putting the code in. But how can i see if it worked like intented? Can you help me?

TerenceKEANE
Shopify Partner
512 86 79

You are welcome😉

 

When you select the relevant area and then right-click and inspect with the mouse, you can see it as follows. I dont send any code without trying it. Let me know if you can't do it!

 

TerenceKEANE_0-1713430736447.png

 

★ Looking for Dedicated Premium Coding Support? Join our unique "PREMIUM SUPPORT" service starting at 59 USD for 1 MONTH!
★ Get skilled Shopify developers at BUDGET-FRIENDLY RATES — explore Novajetsoft.com for a rapid quote!
If my support was a lifeline for you, The COFFEE  
would be the anchor keeping me steady!
★ For Quick response --> WhatsApp | Email --> info@novajetsoft.com | Software Engineer - Specializing In Advanced E-Commerce Websites
Petpower
Excursionist
17 0 2

I doesn't seem to work, Have i input it wrong. This message popup. Attempting to close HtmlElement 'script' before HtmlElement 'head' was closed

picture.png

TerenceKEANE
Shopify Partner
512 86 79

I've just tested it myself, and everything seems to be working fine. Could you try placing the codes above the </head> tag?

 

TerenceKEANE_0-1713437313847.png

 

★ Looking for Dedicated Premium Coding Support? Join our unique "PREMIUM SUPPORT" service starting at 59 USD for 1 MONTH!
★ Get skilled Shopify developers at BUDGET-FRIENDLY RATES — explore Novajetsoft.com for a rapid quote!
If my support was a lifeline for you, The COFFEE  
would be the anchor keeping me steady!
★ For Quick response --> WhatsApp | Email --> info@novajetsoft.com | Software Engineer - Specializing In Advanced E-Commerce Websites
Petpower
Excursionist
17 0 2

i Have tried that now too. the message stopped showing, but it's still H3

Petpower
Excursionist
17 0 2

I got it to work, by putting it all the way at the bottom of the script

yes.png

TerenceKEANE
Shopify Partner
512 86 79

Exactly how are you looking at it? In the image at the link below, it appears as an h1.

 

https://petpower.dk/collections/hundetegn-skilte

 

TerenceKEANE_0-1713505561856.png

 

★ Looking for Dedicated Premium Coding Support? Join our unique "PREMIUM SUPPORT" service starting at 59 USD for 1 MONTH!
★ Get skilled Shopify developers at BUDGET-FRIENDLY RATES — explore Novajetsoft.com for a rapid quote!
If my support was a lifeline for you, The COFFEE  
would be the anchor keeping me steady!
★ For Quick response --> WhatsApp | Email --> info@novajetsoft.com | Software Engineer - Specializing In Advanced E-Commerce Websites