02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Creating a Page Title

In this video, we explore the TITLE tag, one of the most important elements in the HEAD section of an HTML page. Learn how to create a meaningful page title that is visible in browser tabs, bookmarks, and search engine results. A well-crafted title improves user experience and helps your page rank better in search engines.

Video Transcript

00:00Let's put something into the head itself just to showcase
00:02how is the head used.
00:05so one tag that you can only put in the head itself
00:07is called 'title' tag
00:09Now, for title tag, you open and close tag.
00:12Every single tag you create in HTML,
00:14you have to open it, you have to close it.
00:16If you don't close it, you're creating invalid HTML
00:19creating invalid html means that some browsers will not render it correctly
00:23It means that google and other search engines
00:27when they see your page and they see you created a shitty page
00:30or, excuse my French, slappy page or spaghetti page,
00:34or page that wasn't built up correctly,
00:37google is going to say: oh this is a crappy page anyways, let me skip it.
00:41-If you have a bad score on your page, no one is going to see it anyways
00:44-got ya!
00:45So it's really important, you open a tag - you close a tag.
00:47and we are going to learn later on, after we build a little bit more
00:50how do we find bugs in our page, and how do we fix them
00:53but that is way to early for that, right now
00:55In our title itself... and what is the title ?
00:57The title is what you see on the header,
01:00right now we get a default of the name of the file
01:02but that's not very intuitive.
01:05The reason why we need a header...
01:07If a user wants to bookmark the page,
01:09and they go into their bookmarks, well you don't need to see my bookmarks
01:14but in your bookmarks, if you have a title to your bookmarks
01:18then you could see what was the page title.
01:21-yeah, you could find it, yeah.
01:22-exactly, if it's just a file name then it's not that useful.
01:26If you have few tabs opened up at the same time
01:28it would be useful to be able to know what's inside of the page
01:38also, if I go into google and search for my favorite search term which is 02geek
01:42you will see that 02geek pops up
01:45and you'll see also some information like
01:48lifetime membership - and some information
01:50indispensable action scripts - some information
01:52These titles are created from the titles that we put into our HTML page
01:57for example: 02Geek training on twitter,
01:59that's also us
02:00and this title is generated by twitter.
02:04So the user doesn't have to go into the page to know what is going on
02:09By the way, the title 02geek is horrible
02:12it seems like it's just 02geek
02:13we should put a little bit more 'meat' into that tile
02:16we'll take care of that, maybe when you do your search.
02:19What we want to do next is we want to put in a title
02:22a good title for hello world and a good title for that
02:24would be maybe '02geek Hello World'
02:37'HTML Hello World' would be probably the best
02:42We're going to save that
02:43Once we saved that, let me go into our browser and we click on 'refresh'
02:46you'll see that 02geek HTML Hello World has been updated in the title
02:50And we can see it also in the tab itself: 02GEEK HTML Hello World'
02:53so now, even if we are in another page
02:55we can very clearly see what's inside of that page.
02:59Just to tip in general, When you figure out what title you want to use
03:03you really want to put there a title,
03:04it's not too long, that is informational
03:06and easy to people to know what's gonna be inside of it
03:08before you go in it, also to make it convenient for them
03:11to bookmark, but also to make it more usable
03:14when people search for it in google
03:15Because if they don't see something that's relevant for them
03:17they're not gonna click on it - which makes sense

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!

Lesson notes

In this tutorial, we’ll focus on the TITLE tag, an essential element in the HEAD section of every HTML page. You’ll learn how to create meaningful page titles, why they matter, and how they enhance both user experience and search engine optimization (SEO).


1. What is the TITLE Tag?

The TITLE tag specifies the title of the HTML page. It is:

  • Displayed in the browser tab.
  • Used as the label for bookmarks.
  • Shown in search engine results as the clickable link.

The TITLE tag belongs in the HEAD section of the HTML document.

Example:

<head>
  <title>HTML Training with Mom - Lesson 1</title>
</head>

2. Why is the TITLE Tag Important?

  1. User Experience:

    • A descriptive title helps users quickly identify the purpose of a webpage.
    • It’s visible in browser tabs and bookmarks, making it easier for users to find your page later.
  2. Search Engine Optimization (SEO):

    • Search engines like Google use the TITLE tag to display your page in search results.
    • A relevant, clear, and concise title improves your page’s visibility and encourages users to click.

3. How to Create a Good TITLE

Follow these best practices when crafting a TITLE tag:

  1. Keep It Relevant: Reflect the content of the page.
    Example:
    <title>HTML Basics - Adding a Title to Your Page</title>
    
  2. Make It Concise: Aim for 50–60 characters to ensure it displays fully in search results.
  3. Use Keywords Wisely: Include keywords users might search for.
    Example:
    <title>HTML Tutorial for Beginners - Adding a Page Title</title>
    
  4. Be Informative: Provide enough information for users to understand the page’s purpose.

4. Adding a TITLE Tag to Your Page

Let’s add a TITLE tag step by step:

  1. Open Your HTML File:

    • Use a plain text editor like Sublime Text or Notepad.
  2. Add the TITLE Tag:
    Insert the following code into the HEAD section of your HTML:

    <head>
      <title>02Geek HTML Hello World</title>
    </head>
    
  3. Save the File:
    Save your file with the .html extension.

  4. Test It in a Browser:

    • Open the file in a browser.
    • The title should appear in the browser tab.

5. What Happens If the TITLE Tag Is Missing?

If you don’t include a TITLE tag:

  • The browser uses the file name as the title (e.g., index.html), which is not informative.
  • Search engines might skip your page or rank it poorly due to the lack of metadata.

Summary

By the end of this tutorial, you’ve learned:

  1. What the TITLE tag does and why it’s important.
  2. How to add a TITLE tag to your HTML page.
  3. Best practices for creating effective and user-friendly page titles.

What’s Next?

In the next lesson, we’ll dive into additional HEAD section elements like metadata and linking stylesheets to further enhance your webpage.

Continue your journey: HTML Training with Mom.