DEV Community

Cover image for HTML meta tags
Pratap kute
Pratap kute

Posted on

HTML meta tags

An Introduction to HTML5 Meta Tags

HTML5 Meta tags are an essential part of any web page's structure. They provide information about the web page to search engines, browsers, and social media platforms. This information includes the title, description, keywords, author, and other metadata that help users find your website and understand its content.

Understanding Meta Tags: The Labels of Webpages

When I first started coding, I became familiar with webpages (HTML). I believe many developers had a similar experience, especially those who began after 2009. I often used it to save web pages, but I always wondered: what are meta tags?

Meta tags are like labels that tell web browsers and search engines important information about a webpage. They help browsers understand how to display the page and tell search engines what the page is about. It's like putting a name tag on your school bag so everyone knows whose it is and what's inside.

There are numerous things meta tags can accomplish for you. For instance, you can utilize them to perform tasks such as refreshing the page and setting the character encoding, without needing to write JavaScript.

<meta http-equiv="refresh" content="2500">
Enter fullscreen mode Exit fullscreen mode

Isn't that convenient?”

What are HTML5 Meta Tags?

HTML5 Meta tags are special bits of code you add to the head section of your webpage's code. They give extra info about your webpage, but people don't see them directly on the page. Instead, search engines and other tools use them to understand your webpage better.

Here are some common types of meta tags:

  1. Title: This tag sets the title of your webpage. It shows up in the browser's title bar and search engine results.
  2. Description: This tag gives a summary of what your webpage is about. It also shows up in search results.
  3. Keywords: This tag lists important words or phrases related to your webpage's content.
  4. Author: This tag says who made the webpage.
  5. Viewport: This tag controls how your webpage looks on mobile devices.
  6. Robots: This tag tells search engines if they should index your webpage or follow its links.

Why do web developers need to care about Meta Tags?

Meta tags are important bits of code you put in your website's HTML. They help search engines like Google understand what your page is about so they can rank it properly in search results.

Think of it like this: when you meet someone new, you introduce yourself and give them some basic information about who you are, right? Meta tags do the same thing for your website. They tell search engines what your page is all about, so they can show it to people who are searching for that kind of information.

Social media sites like Facebook and Twitter also use these meta tags to show a preview of your webpage when someone shares it. So if you don't have these tags, the social media platform might just guess what your page is about, and it might not look as good when someone shares it.

How to Use HTML5 Meta Tags?

To use HTML5 Meta tags, you need to insert them into the head section of your web page. Here is an example of how to insert the title, description, and keywords meta tags:

<head>
  <title>My Web Page Title</title>
  <meta name="description" content="This is a brief description of my web page content.">
  <meta name="keywords" content="web page, HTML5, meta tags">
</head>
Enter fullscreen mode Exit fullscreen mode

There are many use cases for meta tags. For more details, you can visit the MDN page

Conclusion

HTML5 Meta tags are an essential part of any web page's structure. They provide additional information about the web page that is used by search engines, browsers, and social media platforms. By using meta tags correctly, you can improve your web page's search engine rankings and increase its visibility on social media platforms.

References

Mozilla Developer Network (MDN)

W3Schools

Top comments (0)