Recent chats
ASKGEEZ Q&A GUIDETechnology & devices

How do I write a useful page title in the HTML document head?

Quick answer

Put a descriptive, concise <title> element in the document’s <head>. Make it identify the particular page, not just the site, and put the most useful identifying words early. The title is document metadata shown in places such as browser tabs; it is not the same thing as the visible page heading. Keep titles for related pages distinct, even when they share a site or section name. [S1] [S2]

LET’S WORK THROUGH IT

The question, the details, the next step.

Question

What exactly am I writing when I write a page title in the HTML head? Is it the same thing as the heading readers see?

Geez

You are writing the document title: the text inside a <title> element in the page’s <head>. It provides the document’s title for contexts such as a browser tab. [S1]

That is different from the visible content heading, commonly marked up as an <h1> in the page body. The two elements serve different contexts: the title identifies the overall document, while the heading titles the content readers see on the page. [S2]

For example, a page could have the document title Returns | Northside Books and a visible heading How to return an order. The wording can be related, but do not assume that the head title is simply the on-page heading copied into another location.

Follow-up question

How do I make it specific without making it long or repeating the same title on every page?

Geez

Name the page’s particular subject or purpose first, then add a short site or section name if it helps identify where the page belongs. Keep the wording concise, make titles distinct from one another, and put the important identifying information early. These are practical applications of MDN’s guidance to use a descriptive, concise title that identifies the page and differs from other site titles. [S1]

Try this drafting pattern—not a mandatory HTML rule:

[Page-specific subject or task] | [Site or section]

For a small group of related pages, assuming a site called Northside Books and an order-help section, a draft set might be:

  • Track an Order | Northside Books
  • Change a Delivery Address | Northside Books
  • Return an Order | Northside Books

The shared ending signals that the pages belong together; the opening phrases distinguish their purposes. If the site name adds clutter or pushes the identifying words back, shorten the ending or leave it out. There is no single title pattern that fits every website. [S2]

Follow-up question

Can you show me where it goes in the document, and how to handle a title that resembles the visible heading?

Geez

Place the element inside the document head, not among the visible page content. For example, if the visible heading is Return an Order, you could use a more identifying document title while keeping the page heading natural:

<head>
  <title>Return an Order | Northside Books</title>
</head>
<body>
  <h1>Return an Order</h1>
</body>

Here, Northside Books is an illustrative placeholder site name, not a required title component. It is reasonable for the two texts to share the page’s main wording, but the document title can add context that helps identify the page in a browser tab. The heading remains the body’s content title; neither element should be mistaken for the other. [S1] [S2]

Follow-up question

What should I check before using titles across a set of pages?

Geez

Draft the titles as a set, not one at a time. Compare them side by side: each should identify its own page, and a reader scanning the titles should be able to tell the pages apart. Then check each title in the HTML head and compare it with the visible heading to ensure each serves its intended context. [S1] [S2]

The guidance here does not establish a fixed character limit, guarantee how every browser or other service will display a title, or prescribe one required pattern for all sites. Treat the examples as an editing method, then adjust the wording to suit your pages.

A practical checklist

  • Write a short draft that names the specific page or task.

  • Put the page-identifying words early; add a site or section name only if it helps.

  • Compare titles for related pages and revise any that are indistinguishable.

  • Confirm the <title> element is in the document head.

  • Check that the visible page heading remains the body’s content title.

A few more useful answers

Should the document title and visible heading be identical?

They may share the main wording, but they serve different contexts. The document title identifies the overall document; the visible heading titles the page content. [S2]

Is there one required format or length for every title?

No universal pattern is established here. Aim for a concise, descriptive title that identifies its page and differs from other site titles. [S1] [S2]

Sources

References used for this guide.

  1. [S1] MDN: HTML document title element
    developer.mozilla.org · Checked
  2. [S2] MDN: Webpage metadata and the document head
    developer.mozilla.org · Checked

YOUR QUESTION. YOUR DETAILS.

Let’s work through your situation.

Get a tailored answer or help with your next task. Starts at $1, with a quote before you pay.

Ask your own question
← Back to Geez at Work