Shopify themes, liquid, logos, and UX
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
Solved! Go to the solution
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.
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.
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?
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!
I doesn't seem to work, Have i input it wrong. This message popup. Attempting to close HtmlElement 'script' before HtmlElement 'head' was closed
I've just tested it myself, and everything seems to be working fine. Could you try placing the codes above the </head> tag?
i Have tried that now too. the message stopped showing, but it's still H3
I got it to work, by putting it all the way at the bottom of the script
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
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024