04. HTML Meta Tags

Oftentimes, beginning web developers won't include meta tags because they don't affect any contents on the webpage. However, including meta tags are vital, as search engine bots use them to crawl through webpages. Thus it's important to practice including meta tags, especially if you would like to direct organic traffic onto your webpage.

There are five main meta tags that you should know about.

1) Charset

As we just saw in setting up our HTML playground, the charset declares what character encoding your webpage is using. The most common charset value is UTF-8, which includes a plethora of characters outside the Roman alphabet.

<meta charset="utf-8" http-equiv="Content-Type" content="text/html">

2) Viewport

The viewport meta setting tells the browser how content should fit on a device's screen. The following snippet tells that the browser to set the viewport (the visible size of the window) to the width of the device, with an initial scale of 1 (no zoom).

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

3) Description

The description meta tag will describe the contents of your page

To apply a description alongside your page, insert the following meta tag:

<meta name="description" content="Code Snippets Academy is a website that provides free tutorials for HTML, CSS and Javascript.">

The description written may show up on a Google search. For example, if I Google "vintage coins" a link to eBay shows up:

Sample Google Image Search for 'Vintage Coins'

The "Shop huge inventory..." portion is the meta description for the page.

Tips for writing a great description

  • Accurately summarize the page's content.
  • Avoid vague or generic words like "This is a webpage about...".
  • Don't fill the description with only keywords. There is another meta tag for that.
  • Use unique descriptions for each page.

4) Keywords

You may also specify keywords for search engines. To do so, simply write it as the value of the "content" attribute like so:

<meta name="keywords" content="HTML, CSS, JavaScript">

5) Author name

You may also write the author name.

<meta name="author" content="John Doe">

Great! That wraps it up for our introduction. Now let's learn how to apply actual content onto our HTML document!

Aching back from coding all day?

Prism Glasses

Aching back from coding all day? Try Back Problems

Ever feel achy from sitting crunched up on your computer table? Try lying down with these optical glasses that allow you to work on your laptop while lying flat on your back. This is the perfect solution with those with limited mobility or those who wish to prevent neck cramps and back strains.

$ Check price
4.454.45Amazon 4 logo(128+ reviews)

More Back Problems resources

Build modern and responsive webpages

JavaScript & JQuery

Build modern and responsive webpages Try Front-end

This book was written for anyone who wants to use JavaScript to make their websites a little more interesting, engaging, interactive, or usable. In particular, it is aimed at people who do not have a degree in computer science (well, not yet anyway).

$ Check price
39.9939.99Amazon 4.5 logo(385+ reviews)

More Front-end resources

Ad