Head tag misplacement
odrastudio opened this issue · 2 comments
Hi there :)
Sorry for the previous empty issue, accidentally posted it whilst writing.
I have an issue with the rendered placement of a HEAD tag in the document. It seems wherever I place the head tag template it is always injected inside the BODY template which is wrong according to html documentation (from my research of course).
The actual head tag that is first rendered in the DOM only contains WP's emoji pack.
I am attaching a screenshot with the order of elements in the header.php of the theme. Do you maybe know what's the issue here?
This issue is likely cause by the browser that tries to auto fix the invalid HTML code and fails to format it. Invalid HTML is caused by following:
-
div
andvideo
elements beforehtml
- this is not valid HTML and these things need to go inbody
-
head
tag is missing - In the original template there arehead
tags below thehtml
tag -
template inclusion before the
body
tag -header.php
template andmailto
link need to be inside the body. -
Since there is no
head
tag,script
tag is in invalid placement.
On the other hand JS libraries should not be included like that in WordPress. There are hooks and functions for enqueueing assets. We've also enabled that you can use external libraries by installing them with npm an importing them only were they are needed.
Thank you so much!
Now it works fully, had no idea about some of those things :)
I actually have one more issue that I can't seem to resolve, but will open another ticket for that.
Thank you once more :)