The <head> of a page is invisible to visitors, but it decides how the page appears in browser tabs, search results and social media previews. A well-written head with a clear title, a useful description and correct meta tags helps search engines understand your page and makes people more likely to click it. This lesson walks through a complete head section and the basics of search engine optimisation (SEO).
In this lesson you will learn
- The essential tags: charset, viewport, title and description
- Canonical URLs
- Open Graph and Twitter cards for social previews
- Favicons, theme colour and robots
- Structured data with JSON-LD and on-page SEO habits
A Complete Head Section
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Shown in the browser tab and as the headline in search results -->
<title>CSS Flexbox Tutorial with Examples | Core Tech ED</title>
<!-- Often used as the snippet under the headline in search results -->
<meta name="description" content="Learn CSS Flexbox step by step: containers, alignment, wrapping and responsive layouts, with live examples.">
<!-- The preferred URL when the same page has several addresses -->
<link rel="canonical" href="https://example.com/learn/css-flexbox/">
<!-- Open Graph: the preview card on Facebook, LinkedIn, WhatsApp -->
<meta property="og:type" content="article">
<meta property="og:title" content="CSS Flexbox Tutorial with Examples">
<meta property="og:description" content="Containers, alignment, wrapping and responsive layouts.">
<meta property="og:image" content="https://example.com/images/flexbox-card.png">
<meta property="og:url" content="https://example.com/learn/css-flexbox/">
<!-- Twitter / X card -->
<meta name="twitter:card" content="summary_large_image">
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="stylesheet" href="/css/site.css">
<meta name="theme-color" content="#00695c">
<!-- Keep a page out of search results (for example a thank-you page) -->
<!-- <meta name="robots" content="noindex"> -->
</head>
<body>
<h1>CSS Flexbox Tutorial</h1>
</body>
</html>
<meta charset="UTF-8">must come first so Bangla and other non-English text displays correctly. The viewport tag is needed for responsive design.- The
<title>appears in the tab and is usually the clickable headline in search results. Make it unique and descriptive, put the main topic first, and keep it under about 60 characters. - The meta description is often used as the text under the headline. Write a clear summary of about 150 to 160 characters. It does not directly raise rankings, but a good one earns more clicks.
<link rel="canonical">tells search engines which address is the main one when the same content is reachable at several URLs, for example with tracking parameters.- Open Graph tags (
og:title,og:imageand so on) control the preview card when the link is shared on Facebook, LinkedIn or WhatsApp. A 1200×630 image works well. - Favicons give the tab an icon;
theme-colortints the browser bar on mobile;robotswithnoindexkeeps a page out of search results.
Structured Data
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "CSS Flexbox Tutorial with Examples",
"author": { "@type": "Organization", "name": "Core Tech ED" },
"datePublished": "2026-11-16",
"image": "https://example.com/images/flexbox-card.png"
}
</script>
- Structured data describes the page in a machine-readable vocabulary from schema.org. It goes in a
<script type="application/ld+json">block, usually in the head. - Search engines can use it to show rich results, such as star ratings, recipes, events or breadcrumbs. Every lesson on this site includes an
FAQPageblock built from its FAQ section. - Test your markup with Google’s Rich Results Test or the Schema.org validator.
On-Page SEO Checklist
| Item | Good practice |
|---|---|
| Headings | One h1 that matches the topic; logical h2/h3 structure |
| URLs | Short, readable, with hyphens: /learn/css-flexbox/ |
| Content | Answers the searcher’s question clearly and originally |
| Internal links | Link related pages with descriptive anchor text |
| Images | Descriptive file names and alt text, compressed files |
| Speed and mobile | Fast loading, responsive layout (check with Lighthouse) |
| HTTPS | Serve every page securely |
Submit an XML sitemap in Google Search Console and Bing Webmaster Tools so new pages are found quickly, and use the reports there to see which searches bring visitors.
Common Mistakes
- The same title and description on every page.
- Keyword stuffing: repeating a phrase unnaturally, which search engines penalise.
- Forgetting
og:image, so shared links show no picture or a random one. - Leaving
noindexon pages after launching a site.
Practice Exercises
Exercise 1. Write a title and meta description for a page teaching Python lists.
Show answer
<title>Python Lists: Create, Access and Modify (with Examples)</title>
<meta name="description" content="Learn Python lists step by step: creating lists, indexing, slicing, adding and removing items, and common list methods, with runnable examples.">
Exercise 2. Which tag would you add to a “thank you for registering” page, and why?
Show answer
<meta name="robots" content="noindex">, because the page has no value in search results and should only be reached after submitting the form.
Frequently Asked Questions
Does the meta keywords tag help SEO?
No. Major search engines have ignored <meta name="keywords"> for many years because it was widely abused. You can leave it out.
How long does it take for a new page to appear in Google?
Anything from a few hours to several weeks. Submitting a sitemap, linking to the page from existing pages and requesting indexing in Search Console all help.
Summary
- Every page needs charset, viewport, a unique title and a meta description.
- Canonical links, Open Graph tags and favicons control how the page is identified and shared.
- JSON-LD structured data enables rich results.
- Good content, headings, links, speed and accessibility are the core of SEO.
