HTML Meta Tags- Everything a front-end developer should know
Tags: html, webdev, codenewbie
Published: 2020-11-18 16:27:55

---
title: HTML Meta Tags- Everything a front-end developer should know
published: true
date: 2020-11-18 16:23:48 UTC
tags: html,WebDevelopment,codeNewBie
canonical_url: https://rajeshdhiman.in/html-meta-tags-everything-a-front-end-developer-should-know/?utm_source=rss&utm_medium=rss&utm_campaign=html-meta-tags-everything-a-front-end-developer-should-know
---
The post [HTML Meta Tags- Everything a front-end developer should know](https://rajeshdhiman.in/html-meta-tags-everything-a-front-end-developer-should-know/) appeared first on [Rajesh Dhiman's Blog](https://rajeshdhiman.in).

<!-- wp:paragraph -->
<p>Meta tags help us to provide the metadata (the information about the data) of a web page.<br>Any website is incomplete without meta tags. The fancy little previews of websites that you see on social media or chat messages are there because of meta tags.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The code used to create meta tags is not displayed on your web page, but it is machine-readable and visible to machines (other apps) and search engines. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>With meta tags, search engines can index your web page and use that information to identify the content of your site that you want to be viewing.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Why do we need meta tags?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>e.g. if you have a website and you want it to be indexed by a search engine like Google. You provide a few meta tags, so the search engine can parse your metadata and index your pages to the appropriate meta tags.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><br>Meta tags are one of the most basic but underrated tools available to the webmaster. They are the elements of a webpage that describe the content and categorize every page from a search engine's point of view. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Knowing how and when to use meta tags and most importantly, how to choose the right meta tags for your webpage can make a significant difference in the way people find your page on Google.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Meta tags are a way to tell search engines how to crawl your website, what content you're serving and what search keywords search engines should show you on their first page.<br>Meta tags are HTML elements that are used to help search engines categorize a page. They are used to manage a page's description, keywords, character set and other features.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>How can we use HTML meta tags?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>You can add metadata to your web pages by placing tags inside the header of the document i.e. between the and tags.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Below are the most common attributes of a meta tag:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Charset</strong> - charset is used to define the character encoding for your HTML document. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If the attribute is present, it must be an ASCII case-insensitive match for the string "utf-8", because UTF-8 is the only valid encoding for HTML5 documents. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Meta elements which declare a character encoding must be located entirely within the first 1024 bytes of the document.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>&lt;meta charset="UTF-8"></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p><strong>Content</strong> - This attribute contains the value for the http-equiv or name attribute, depending on which one is used in the same tag.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Http-equiv </strong>- This attribute is called http-equiv(alent) because all the allowed values for http-equiv are names of specific HTTP headers.<br>It is used to specify values for HTTP response headers for a web page. For example, http-equiv can be used to refresh the page or to set a cookie.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p> The values for http-equiv include content-type, expires, refresh and set-cookie.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>&lt;meta http-equiv="refresh" content="30"></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p><strong>Name</strong> - The name and content attributes are used together to provide document metadata in terms of name-value pairs, with the name attribute giving the metadata name, and the content attribute giving the value.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Meta tags every developer should know :</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><strong>Author</strong> - The name of the document's author.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>&lt;meta name="author" content="Rajesh Dhiman"></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p><br><strong>Description</strong> - Description is a short and accurate summary of the contents of the page. Several browsers, including Firefox and Opera, use this as the default description for bookmarked pages.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>&lt;meta name="description" content="This ultimate guide covers all the important aspects of HTML meta tags. Find out what are HTML meta tags? Why do you need meta tags? How to use meta tags in your HTML page?"></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>A meta description is the snippet of text visible in search listings. It's like an ad placed by a web page that is both shown to users and indexed by search engines like Google.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><em>Don't: Use the same descriptions and keywords on every page on your site.</em></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Keywords</strong>: Keywords are words relevant to the page's contents, separated by commas.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>&lt;meta name="keywords" content="html meta tags, web development, learn web development, front end development"/>  </code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>The code should contain keywords and phrases you'd like the engine to associate with your site.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><em>Don't: Use the same description and keywords on every page on your site. Include the meta keyword meta tag instead.</em></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Viewport</strong> - gives hints about the size of the initial viewport. It is only used for mobile devices.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>&lt;meta name="viewport" content="width=device-width, initial-scale=1.0"></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p><strong>theme-color:</strong> indicates a suggested color that user agents should use to customize the display of the page or the surrounding user interface. The content attribute contains a valid CSS , which is used to specify the color of the page. Check out <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color" target="_blank" rel="noreferrer noopener">mdn</a> for more details on theme-color.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>&lt;meta name="theme-color" content="#4285f4"></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p><strong>robots</strong> - this is used to tell search engines to index or not specific web pages in your website.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>&lt;meta name="robots" content="noindex,nofollow"></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>There are also meta tags for <a href="https://ogp.me/" target="_blank" rel="noreferrer noopener">open graph protocol </a>which are used by Facebook. and Twitter cards which are used by Twitter to show previews or your web pages. You should consider adding these to your webpages to customize previews of your content for these social networks. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a rel="noreferrer noopener" href="https://gist.github.com/whitingx/3840905" target="_blank">Here</a> is a detailed list of other meta tags that you can use. </p>
<!-- /wp:paragraph -->

<!-- wp:coblocks/gist {"url":"https://gist.github.com/whitingx/3840905","file":""} -->
<div class="wp-block-coblocks-gist"><script src="https://gist.github.com/whitingx/3840905.js"></script><noscript><a href="https://gist.github.com/whitingx/3840905">View this gist on GitHub</a></noscript></div>
<!-- /wp:coblocks/gist -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Let me know if you find this information useful. What are the other meta tags that you think are important for any web page? </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Resources: </p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta</li><li>https://www.w3schools.com/tags/tag_meta.asp</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->