Meta Tag
Meta tags are tags included in the head section of an HTML document used to specify metadata (data about data) concerning the web page. Meta tags provide information that affects the page’s content and characteristics, SEO, browser behavior, and more.
Main Uses of Meta Tags
SEO (Search Engine Optimization):
Provide search engines with information about the page’s content, keywords, and descriptions.
Page Description:
Provide summaries or descriptions of the page, used for display in search results and social media.
Page Characteristics:
Give instructions to browsers, such as specifying the character encoding and viewport settings.
Redirects and Cache Control:
Set up page redirects and control caching.
Representative Meta Tags
Specifying Character Encoding:
<meta charset="UTF-8">
Page Description:
<meta name="description" content="This is an example of a meta description tag">
Specifying Keywords:
<meta name="keywords" content="HTML, CSS, JavaScript, SEO">
Author Information:
<meta name="author" content="John Doe">
Viewport Settings:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Refresh and Redirect:
<meta http-equiv="refresh" content="30"> <!-- Or redirect --> <meta http-equiv="refresh" content="5;url=http://www.example.com/">
Cache Control:
<meta http-equiv="cache-control" content="no-cache">
Open Graph (OG) Protocol:
<meta property="og:title" content="Example Title"> <meta property="og:description" content="Example description"> <meta property="og:image" content="http://example.com/image.jpg"> <meta property="og:url" content="http://example.com/">
Summary
Meta tags provide metadata about a web page and are used for SEO, page descriptions, characteristic settings, redirects, cache control, and social media display controls. Proper use of meta tags contributes to search engine optimization and enhances user experience. Understanding the attributes and content of each meta tag and setting them appropriately is essential.