Knowledge Base - Resources - seoClarity

H1 Tag Found Outside Body

Written by Suraj Lalchandani | April 26, 2023

<h1> tags are expected to exist in the <body> of a page. If the <h1> is outside the body, they should be deleted and re-added in the appropriate place.

Here’s how to do it.

Table of Contents


Why H1 Tags Should Be in the <body>

The <h1> tag is an excellent way to clue search engines into what a page is about, but search engines may not recognize your <h1> tag if it’s not located within the <body> section.

So, if search engines can’t recognize your H1 heading tags, you miss an important opportunity to feed information to the search engine and increase page relevance.

How to Move the H1 to the <body>

The solution here is simple: ensure <h1> tags exist in the body of the page. If your H1 is currently outside of the <body> you can delete that tag—it will be added back later.

In your site’s HTML, you’ll notice if your H1 is outside of the <body>. Here’s an example:

<body> … </body>
<h1>Example Heading Tag</h1>

Since this example H1 is outside of the <body>, search engines may not pick it up. So, to start the process of solving this issue, this H1 should be deleted. It can be removed from your site’s HTML.

If you don’t have the necessary edit access to make changes to the site’s code, the dev team should be able to help.

Once the tag is gone, it can be re-added — this time in the right place within the <body>. Here is an example of what that would look like:

<body>
<h1>Example Heading Tag</h1>
</body>

How to Optimize H1 Tags at Scale

Another way to solve this issue involves using SEO execution platform ClarityAutomate. In just a few minutes, you can delete and add H1 tags across multiple pages on your site.

Delete the <h1> tag that is outside the <body>

1. Select what you'd like to optimize: Code

To begin, select “Code” in ClarityAutomate, since that’s what will be optimized.

2. Choose how you'd like to optimize it: Delete

Before the H1 can be added inside the <body>, the existing tag needs to be deleted.

3. XPath location: XPath of the <h1> tag outside the <body> that needs to be removed

This step specifies the H1 tag that will be deleted.
 

Add the <h1> tag within the <body>

1. Select what you'd like to optimize: Code

Now, the H1 can be added again, this time in the correct location. This change also requires a change to the site’s code.

2. Choose how you'd like to optimize it: Add New

As opposed to deleting or updating, an element is being added.

3. XPath location: XPath within the <body> where you need the <h1> tag added

This specifies where in the <body> the new H1 will be added.

4. Code: The <h1> tag with the text you want added.

Lastly, enter the code of the H1 tag and push the changes live!

Summary

If an H1 tag exists outside the <body> it should be deleted and re-added in the appropriate location. This critical fix can be implemented across your site with just a few clicks with ClarityAutomate.

Looking for other heading tag issues?