HTML Metadata Get Certified
What is HTML Metadata?
HTML metadata provides information about a webpage that is not displayed to the user but is essential for browsers, search engines, and social platforms. Meta tags live inside the <head> section and control character encoding, responsiveness, SEO descriptions, indexing rules, and social sharing previews.
Most Important Meta Tags
<meta charset="UTF-8">– Sets the character encoding<meta name="viewport">– Makes the page mobile-friendly<meta name="description">– Summary that can appear in search results<meta name="robots">– Controls indexing and crawling- Open Graph tags – Control how the page looks when shared on social media
HTML Metadata Code Examples
1. Essential Meta Tags
The minimum set of meta tags every modern HTML page should have.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Metadata Tutorial</title>
<meta name="description" content="Learn how to use HTML meta tags for SEO, mobile responsiveness, and better search visibility.">
<meta name="robots" content="index, follow">
<link rel="canonical" href="https://www.example.com/html-metadata">
</head>
<body>
<h1>Essential HTML Metadata</h1>
<p>This page includes charset, viewport, description, robots, and canonical tags.</p>
</body>
</html>
2. Open Graph & Social Sharing Tags
These tags control how your page appears when shared on Facebook, LinkedIn, Twitter, etc.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Open Graph Example</title>
<meta name="description" content="Example of Open Graph meta tags for social media sharing.">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="HTML Metadata Tutorial">
<meta property="og:description" content="Learn how meta tags improve SEO and social sharing.">
<meta property="og:image" content="https://www.example.com/images/metadata-cover.jpg">
<meta property="og:url" content="https://www.example.com/html-metadata">
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="HTML Metadata Tutorial">
<meta name="twitter:description" content="Learn how meta tags improve SEO and social sharing.">
<meta name="twitter:image" content="https://www.example.com/images/metadata-cover.jpg">
</head>
<body>
<h1>Social Media Meta Tags</h1>
<p>Open Graph and Twitter Card tags control the preview when the page is shared.</p>
</body>
</html>
3. Robots & Indexing Control
Use the robots meta tag to tell search engines whether they should index the page or follow its links.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Robots Meta Tag Example</title>
<!-- Allow indexing and following links (default behavior) -->
<meta name="robots" content="index, follow">
<!-- Other common values:
noindex, nofollow → do not index and do not follow links
noindex, follow → do not show in search but still crawl links
index, nofollow → index the page but do not follow links
none → same as noindex, nofollow
-->
<meta name="description" content="Demonstration of the robots meta tag for controlling search engine behavior.">
</head>
<body>
<h1>Controlling Indexing with Meta Robots</h1>
<p>This page is set to be indexed and its links followed by search engines.</p>
</body>
</html>
Best Practices
- Always include
charsetandviewport. - Write a unique, compelling meta description (150–160 characters).
- The old
keywordsmeta tag is largely ignored by Google — focus on description instead. - Use Open Graph tags for better social sharing appearance.
- Use
rel="canonical"to avoid duplicate content issues.
Web Resources on HTML Metadata
1. MDN : Web page metadata
2. MDN : The <meta> element
3. Google Search Central : Control your snippets
Questions and Answers related to HTML Metadata
HTML metadata is information about the page that is not shown to visitors. It lives in the <head> and helps browsers, search engines, and social platforms understand the page.
No. Major search engines (especially Google) ignore the keywords meta tag. Focus on a good title and meta description instead.
It tells mobile browsers how to scale the page. Without it, mobile devices may show a desktop-sized layout that users have to zoom.
It controls whether search engines should index the page and follow its links. Common values are index, follow and noindex, nofollow.
Open Graph tags let you control the title, description, and image that appear when someone shares your page on social networks.
🧪 Test Your HTML Code
Edit the HTML code on the left and click “Run Code” to see the result on the right.
Click “Run Code” to see the result here.