CodeBlanks Logo Icon CodeBlanks

Title and slug strategy

HTML course · Advanced · Lesson 28/56

Learn SEO-friendly title and slug writing rules.

How do you write an SEO-friendly title?

The <title> element is the biggest factor in search results. Keep it between 50 and 60 characters; if you write longer, the end is cut with an ellipsis. Put the keyword first and the brand name at the end.

Example: Web Design Guide | Alex Blog. Write a unique title for every page; do not reuse the same title across pages. The title and meta description should not repeat the same text.

Slug strategy

The slug is the last part of a URL: like /blog/vegan-recipes. An SEO-friendly slug is short, lowercase, hyphen-separated and carries the keyword.

Do not use non-ASCII letters, spaces or uppercase: write vegan-recipes instead of MyRecipes. Very long slugs get trimmed by search engines; stay within 3 to 5 words.

Title and slug together

The title and slug work together. The title tells users and search engines what the page is about; the slug appears in the URL and builds trust before the click.

Short, clear slugs get more clicks on social media. Put the keyword at the start of the title; separate the brand name with a hyphen or a vertical bar. Example: SEO Guide | Alex Blog, slug: seo-guide.

Exercise Add title and meta description for a product page

Add two tags to the head for a product page: <title> (ending with the brand name, longer than 10 characters) and <meta name="description" content="..."> (product description, non-empty).

Show example solution
<head>
  <title>Handmade Vegan Soap | Green Kitchen</title>
  <meta name="description" content="Our handmade vegan soaps are made with natural oils. Kind to skin and planet.">
</head>

Test yourself

  1. Match the title and slug tips

    Title length
    50-60 characters
    Slug separator
    Hyphen (-)
    Slug letter
    Lowercase
    Brand name spot
    End of title
  2. Which title is best?

    • Vegan Recipes | Green Kitchen
    • Home
    • Vegan Recipes Vegan Meals Vegan Recipes Vegan
    • <title>
    Show answer

    Vegan Recipes | Green Kitchen — Correct. Keyword first, brand last; within 50-60 characters.

  3. Complete the slug

    <a href="/blog/____">Vegan Recipes</a>
    Show answer
    <a href="/blog/vegan-recipes">Vegan Recipes</a>

All lessons in Advanced