SEO// Canonical tag sits in <body>, move to <head>
complete
Shirin Sadr
Sure I had raised this or discussed this with someone previously but can't find it. As per google dev tools - canonical should be implemented in <head>.
Neil McQuillan
This is live and working as I would expect the <head tag no longer contains a <noscript element.
Shirin Sadr
@Neil McQuillan Is the "Google Tag Manager tags remain in the header, but we have deleted the NoScript element. This ensures the tag is compliant with our HTML document type. We also made the same change to the Google Remarketing tag." in today's release the resolution of this case?
This post was marked as
complete
Neil McQuillan
This change has been made and the code has gone for testing.
This post was marked as
in progress
Neil McQuillan
planned
Neil McQuillan
I can see why we've added that <noscript to the header tag. To improve performance we rewrote the rendering code, part of this was to create a system for injecting Javascript tags into the <head element. This greatly improved page load speeds and lower server RAM usage (less garbage collection).
but content needs to go in the head tag
to see this performance benefit. I installed the <noscript with the old method in but it slows page load. On balance as the <noscript tags are to allowing marketing tracking with JS script switched off, which the sites does not support anyway I've removed the <noscript tag.
There are no commercial consequences to this that I can see, apart from the fact that we won't see users with Javascript disabled in Analytics. The alternative is slightly slower page load times for all users and higher server RAM usage.
S
Steven Sproat
Neil McQuillan I think I know why. Your ecommerce sites are declaring the pages as XHTML - this is scrict and doesn't allow <noscript> in the head section which is what may triggering the issue
Viewing the page source in Firefox shows 2 warnings against the closing head tag and opening body (despite the 2 shown in this screenshot being the only occurance that I can see)
Maybe switching to a HTML 5 doctype would help - that allows <noscripts> in the head section
Neil McQuillan
Steven Sproat Interesting, I'll have a chat with the designers here it sounds like we might be onto something, I was not aware of the <noscript doc type issue.
Neil McQuillan
OK.
Google can see the canonical Url
See the image. We've looked at this and the Canonical is inside the head tag if you look at the page source you can see that, however in Chrome developer tools its shifting it for some reason, we're not moving it around with scripts so we're not sure why that occurs, but we don't think it matters.
The <noscript tag is added by Google Tag Manager which all our sites uses.
Changing to HTML 5 would potentially surface a stack of cosmetic oddities and have quite a test surface.
I'm unclear if this is actually a problem based on my first comment about the correct structure of the head tag. Opinions welcome.
Neil McQuillan
I've done some reading and I believe it's possible to get that <noscript tag into the body whilst leaving GTM running, I'm going to look into that.
Neil McQuillan
Steven Sproat: That was so helpful thankyou.
I can confirm that the canonical is correctly located, however for some reason Chrome inspector shows it as elsewhere in the DOM, I suspect this is due to Chrome trying to deal with the <noscript in the header. We've confirmed in WebMaster tools that the canonical can be read by the Google crawler.
All that said the best practice for GTM installation is to put the <noscript part in the body and the main script installation in the <head tag. We're going to make that adjustment.
Thank you both for your patience here, as I pulled the HTML via a source inspector this was not obvious.
Shirin Sadr
Neil McQuillan Straight over my head. But thanks Neil, and Steven 👍
Neil McQuillan
I have just checked a bunch of Url's on your site and they are inside the HEAD tag.
Can you give me an example please?
S
Scott
Neil McQuillan I have checked a few of mine and seem to be in the HEAD tag (just!)
Neil McQuillan
Scott That's been my findings as well which is all good!
Shirin Sadr
Neil McQuillan Scott So it seems to be that on inspect tool - it is sitting within <head> amongst a lot of other elements like meta description and page title and after a <noscript>. However, crawlers are flagging it as an issue, and, perhaps most importantly, Google itself is saying it is not detecting a canonical suggesting issues with the page HTML. I don't know this is the issue for sure, but could it be that <noscript> is interfering with canonicals?
Shirin Sadr
Neil McQuillan As this is a bit out of my depth, I've referred to my technical team and they have asked - As noscript <head> should only contain <link> <meta> and <style> elements, could it be that crawlers can't render the head, because the noscript <head> contains other elements such as images? They've suggested that either moving the <noscript> to the <body>, or otherwise remove any invalid elements from the <head> could resolve this so that crawlers (and mostly Google!) aren't interfered with?
Neil McQuillan
Shirin Sadr can you give me an example page with the issue?
Shirin Sadr
Neil McQuillan www.paulscycles.co.uk/bikes/mountain-bikes
Shirin Sadr
But its the same on all of our pages
Neil McQuillan
Shirin Sadr The only noscript in the head tag is the Google Tag Manager script.
The canonical is currently located in the HEAD tag the location doesn't matter as long as its in the HEAD tag.
Why do you believe there is a problem with Google reading the canonical?
I'm concerned your techies have found something interesting, but it all looks good to me.
Shirin Sadr
Neil McQuillan Because it says User-defined canonical = None on googles crawlers (when in facet nav, we have defined the canonical) and also the TP software crawlers we use say the same which suggests that google isnt catching it and therefore its leaving google to potentially define the canonical. We can send you over an exported report of all the URLs that the softwares are flagging.
S
Scott
💯