Photo by Stephen Phillips - Hostreviews.co.uk on Unsplash
Top 6 HTML Tags for SEO Every Developer Should Know
7 min read
Table of contents
- What Are the Important HTML Tags for SEO?
- Title Tags
- Meta Description Tag
- Heading Tags (H1-H6)
- Alt Attribute
- Canonical Tag
- Robots Meta Tag
This post was originally published on Hackmamba
Search engine optimization (SEO) is a vital part of online marketing. It helps to make your website recognizable to search engines like Google, Yahoo, and Bing. Without SEO, your website will be relatively unknown. You will have fewer visitors, which translates to fewer customers.
The main goal of SEO is to make your website rank higher in search engines. Thanks to SEO, users can easily find your website while looking for information related to your business.
It is essential to use HTML tags correctly when optimizing a website, and they play an important role in increasing your website's ranking and visibility.
This article will look at some of the most important HTML tags for SEO and how to use them.
You'll need the following to follow along with this article:
- A basic understanding of HTML
- An IDE on your computer - you can use Visual Studio Code
What Are the Important HTML Tags for SEO?
HTML tags for SEO increase your website's visibility to users and search engines. These Tags help you connect with your audience much more effectively.
There are a variety of HTML tags you can use to improve the SEO of your website. Here is a few of them:
An essential element of any website is its title tag. Title tags inform the user and search engines of the website's name and purpose. The title tag is usually the clickable blue-colored link in a search engine result page.
In HTML documents, the title tag is always between the head elements:
<head> <title>Your Title</title> </head>
A search engine results page (SERP) displays the website's name and other related data. The SERP is the page that appears after typing a question into Google or any other search engine.
The title is the blue-colored links in the example above. Google would look at the page's title to determine the page's relevance to the user's search query. So if you search "What is HTML?" for example, all contents related to the definition of HTML will appear on the SERP.
Google sometimes rewrites your title for you rather than using the title you provide. It occurs when your page answers the question, but the title does not fit the inquiry. The new page title can be from your heading elements, i.e.,
<h6> elements, anchor text, or a completely new title.
Note: Google will use your title over 80% of the time. If you notice that Google changes your title for most queries, change it.
How to Optimize Title Tag?
Title tag optimization best practices are as follows:
- Avoid using the same title for every web page on your website.
- Keep your titles short. It's unclear exactly how many characters Google can show on the SERP as it varies among screen sizes. It's advisable to keep your page titles within 55-70 characters long. That way, it will fit most screen sizes. Lengthy titles that appear in the SERP are likely to have parts truncated to 600 pixels.
- Avoid stuffing your title with too many keywords. While descriptive keywords can be helpful in your title, repeating them is unnecessary.
Meta Description Tag
The meta description tag summarizes your website's content on search engine results pages. It appears together with your page title in SERP.
Like the title tag, the meta description tag is always between the head elements in an HTML document:
<head> <meta name="description" content="page description"> </head>
The underlined texts in the example above are the meta descriptions of each page.
At times, Google may use a quote from your website instead of your meta description. It occurs when the quoted text matches a given query better than your meta description. Essentially, it will pick the best option to enhance your chances of getting clicks.
How to Optimize Meta Description Tags?
If you fail to write a good meta description or fail to write one at all, Google will do it for you to match the search query. But it is vital to keep the following in mind:
- Keep your meta description short and descriptive. The length of your meta description changes according to the size of the screen, just like the title. For optimal screen compatibility, your meta description should not exceed 150–160 characters.
- Use the exact keywords from your title in your meta description.
- Avoid using quotation marks in your meta description. Google sees double quotation marks as a request to cut the texts at that point where you use it in the SERP. When using non-alphanumeric characters, use HTML entity or avoid using non-alphanumeric characters.
- Use a different meta description for each page on your website.
Note: You can create titles and meta descriptions longer than the suggested lengths but to avoid having them get cut off, make sure your title and meta descriptions begin with your keywords.
Heading Tags (H1-H6)
Heading tags make it easier for readers and search engines to understand the contents of a web page. It helps structure the pages in a website and shows you how they're interconnected.
HTML has six heading tags, ranging from
<h6>. The hierarchy goes from the most important to the least significant, with
<h1> followed by
<h4>, and so on.
The heading tags in your HTML document look like this:
<h1>First heading</h1> // Subject of the web page <h2></h2> // organize subsections of the web page <h3></h3> // organize subsections of the web page <h4></h4> // Add additional information <h5></h5> // Add additional information <h6></h6> // Add additional information
The size of each heading decreases with its importance. In hierarchy,
<h1> is bigger than
<h2> is bigger than
<h3>, and so on up to
How to optimize Heading Tags?
Heading Tags optimization best practices are as follows:
- Use heading tags in order. Go from
<h3>and so on, on your web page. Search engines and online readers using a screen reader will find your page's content harder to understand if you skip heading levels.
- Keep your heading tags short and descriptive. It's best to keep your headings between 20-70 characters long.
- Use only one
<h1>element per web page to avoid confusing search engines.
Alt attribute, also known as alternative texts, describes an image when it fails to load on a web page.
In HTML documents, the alt attribute is always part of an image element:
<img src=" image url" alt="image description">
Alt attributes improve image comprehension for users of assistive technology like screen readers. Also, it makes your image accessible to search engines and provides context for those who want more information about your image.
How to optimize Alt Attributes?
Alt attribute optimization best practices are as follows:
- Keep your alt texts short and descriptive
- Never leave the alt attributes empty
- Avoid using phrases. Don't use "image of" or "graphic of," for example, as the user is already aware that you are describing an image.
A canonical tag tells search engines which web page to show in SERPs. When you want one of two web pages with similar or duplicate contents to be the main page displayed on the SERP, you apply a canonical tag to that page.
HTML documents always have the canonical attribute between head elements:
<head> <link rel="canonical" href="website url"> // The URL of the website you want as the ma // in page </head
How to Optimize Canonical Tags?
Canonical Tags optimization best practices are as follows:
- Use one canonical tag per page
- Always use absolute URLs
- Do not block indexation
Robots Meta Tag
Robots meta tags instruct search engines on what pages to index and what not to index.
In HTML documents, the robot tag is always between the head elements:
<head> <meta name="robots" content="noindex"> // Do not show this page on the SERP <meta name="robots" content="noindex, follow"> // Do not index the page but follow th // e link to other pages <meta name="robots" content="nofollow"> // Index the page but do not follow the link // to other pages <meta name="robots" content="none"> // Do not follow or index this page </head>
content attributes are not case-sensitive.
How to Optimize Robots Meta Tags?
Robots meta tag optimization best practices are as follows:
- Address all bots with robots and individual bots with individual bot names
- Use the different parameters such as Noindex, Nofollow, etc.
This article has taught you the different types of HTML tags used for SEO and the best practices to follow.
You will find the following resources helpful: