Move JavaScript Below HTML Header

javascript seo 63bd70d81f7b2 sej


Google’s John Mueller said It suggests “cleaning up” the HTML elements section so that search crawlers can fully understand your website.

Mueller shared this advice in a Reddit thread. A user asks if the placement of the HTML code could cause her SEO problems.

The answer is yes. Not putting the HTML code at the top of the page can negatively impact your SEO efforts.

Notes on Mueller’s remarks

John Mueller uses the term HTML header. But usually Elements are not referenced as such.

  • HTML header It is commonly understood (in informal terminology) to refer to elements (H1, H2, H3, etc.).
  • header element Including menus, logos, etc.
    A specific HTML element called .
  • Head HTML element A section at the top of an HTML document that contains metadata about the document itself (title, meta description, etc.).

So when Mueller mentions “headers” he specifically We are discussing elements.

John Mueller on JavaScript in Head Elements

Mueller’s intention is that the HTML document It was to emphasize the importance of organizing sections and organizing them with scripts that could be placed elsewhere.

The element should only contain metadata about the document itself for use by browsers and search engines. This allows search engines to understand what the page is about and provide data to browsers and search engines to properly render the web page (that is, display it). correctly).

Some JavaScript code that can be placed after an element should be placed after it.

After moving the JavaScript out of the section, Mueller recommends using Search Console’s rendering tools to see if the page is rendering correctly after the move.

“html header () should be almost at the top. Move the JS below the HTML header and in the Search Console rendering tool, the JS will appear as Make sure you didn’t mess up the section. “

As for the main content, according to Mueller, its placement isn’t that important, but it’s important for Googlebot to understand it properly. It is important to keep the sections neatly organized.

Muller continues:

“While it’s not so important in terms of content, the head part is for machine-readable information that has been identified to be in a specific part of the page, so it needs to be clean on top.

Down with JavaScript! ( inside)”

Why is JavaScript placement important for SEO?

When designing your website, we recommend strategic use of the async and defer attributes to achieve the best rendering and interactivity with the fastest page speeds for your users.

This is because JavaScript can delay rendering while a web page is loading, degrading the user experience.

You can render the HTML first. This allows the user to view content while the JavaScript is loaded in the background using the defer and async attributes appropriately.

sauce: Reddit

Featured Image: StockEU/Shutterstock


Source link

What do you think?

Leave a Reply

GIPHY App Key not set. Please check settings

    Seidr Announcement Facebook

    Investing in Seidr | Andreessen Horowitz

    1673221508filter php

    Quick Tip: How to Filter Data in PHP