- Google relies on metadata inside the <head> element to understand your page for Search.
- If your HTML inside <head> is invalid, Google may ignore metadata that comes after the first invalid element.
- Google tries to handle some errors but invalid markup can cause important metadata (like titles, descriptions, canonical links) to be missed or misused.
What Is Allowed Inside <head>? #
According to the HTML standard, only these elements are valid inside <head>:
- <title>
- <meta>
- <link>
- <script>
- <style>
- <base>
- <noscript>
- <template>
What to Avoid Inside <head> #
- Do not place these elements inside because they are invalid there:
- <iframe>
- <img>
- <iframe>
- If you absolutely must use them, place them after all the valid metadata elements you want Google to see.
- Once Google finds an invalid element in <head>, it assumes the end of <head> and ignores anything after that.
Quick Tips #
- Always validate your HTML to catch errors in <head>.
- Keep your metadata (title, meta tags, canonical, structured data script tags) at the top of <head>.
- Avoid placing images, iframes, or other invalid tags inside <head>—move them to <body> instead.
Summary #
Allowed in <head> | Not allowed in <head> |
title | iframe |
meta | img |
link | other invalid tags |
script | |
style | |
base | |
noscript | |
template |