HTML for SEO's
Understanding some basics of HTML for SEO
Minimal SEO-Friendly HTML
HTML Fundamentals (for SEO)
Core tags: <!doctype>
, <html lang>
, <head>
, <body>
, <title>
, meta tags, <link>
(canonical, icons), <script>
, <header>
, <nav>
, <main>
, <article>
, <section>
, <aside>
, <footer>
, headings <h1>
–<h6>
, <p>
, <a>
, <img>
, <ul>/<ol>/<li>
, <figure>/<figcaption>
.
One clear H1 that describes the page topic (multiple H1s won’t break Google, but keep hierarchy clean: H1 → H2 → H3…).
Title is not the same as H1. Title is for tabs/SERP; H1 is on‑page main heading.
Meta description helps searchers choose; write unique, page‑specific summaries (Google may rewrite).
Links: use crawlable
<a href="…">
with meaningful anchor text.Images: always add contextual
alt
; avoid keyword stuffing. Prefer descriptive file names.Language: set
lang
on<html>
. For multilingual strategy, use dedicated URLs +hreflang
(advanced).Indexing controls: use robots meta only when you need to restrict. Default is indexable.
Semantic Structure & Heading Hierarchy
Do: keep sections logical, one main H1, descending headings, avoid skipping levels when possible.
Don’t: style headings with <div>
s instead of semantic headings; don’t use headings to style text only.
<title>
(50–60 chars aim, unique, descriptive, brand last): Reflect real page topic. Avoid stuffing/boilerplate.<meta name="description">
(up to ~155–160 chars): Persuasive summary; can include price/date/author for relevance.Canonical (
<link rel="canonical">
): One per page pointing to the preferred URL. Avoid chains & self‑conflicts.Robots meta: Page‑specific controls (
noindex
,nofollow
,noarchive
,nosnippet
, etc.). Use sparingly.Open Graph/Twitter Cards: Not a Google ranking factor, but improves social sharing previews.
Favicons & app icons: Good UX; ensure valid paths.
Preload/preconnect (advanced performance): Only for critical assets.
Links & Navigation (Crawlability)
Use real
<a href="/path">Descriptive text</a>
(not JS click handlers alone).Avoid blocking primary nav in
robots.txt
or vianofollow
unless intentional.Internal anchors: use topic‑rich, natural language; avoid “click here”.
Provide footer or secondary nav for discoverability.
Do / Don’t
Do: HTML sitemaps for large sites; breadcrumbs with proper markup.
Don’t: Excessive link stuffing; orphan pages; nav hidden behind required JS with no href fallback.
Images (Alt Text & Context)
Use alt
to describe the image purpose in context (not just keywords).
Decorative images:
alt=""
(empty) to skip for screen readers.Provide intrinsic dimensions (
width
/height
) to reduce CLS (layout shift).Use modern formats (AVIF/WebP) with fallbacks where needed.
Lazy‑load non‑critical images (
loading="lazy"
).
Accessibility Essentials (A11y)
Proper heading order aids screen reader navigation.
Every interactive element must be focusable and keyboard operable.
Provide text alternatives for images/icons.
Use landmark roles (
<header>
,<nav>
,<main>
,<footer>
).Color contrast & visible focus states (CSS).
Form labels linked to inputs (
<label for>
/id
).
Structured Data (Intro)
Prefer JSON‑LD in
<script type="application/ld+json">
within<head>
or<body>
.Mark up content that actually exists on the page (match visible content).
Common types for SEO students:
Article
,BlogPosting
,Course
,Product
,FAQPage
,BreadcrumbList
.
Internationalization (Overview)
Prefer separate URLs for each language/region:
/en/
,/hi/
,/en-in/
…Add reciprocal
hreflang
annotations on each variant.Keep canonical self‑referential to each language page (usually).
Don’t rely on auto‑redirect solely by IP; allow users to switch.
Performance & UX Signals (HTML Side)
Include
meta viewport
for mobile.Reserve space for images/video (width/height) to reduce CLS.
Load critical CSS early; defer non‑critical JS.
Use semantic HTML for better rendering & accessibility.
Common Pitfalls & How to Fix
Duplicate titles/meta: Template bugs—inject unique variables per page.
Accidental
noindex
: Remove from templates; verify with a crawler.Canonical conflicts: Ensure only one canonical; avoid pointing to non‑equivalents; no chains.
Missing alt: Audit with a crawler; add contextual descriptions.
JS‑only links: Add real
<a href>
or server‑rendered anchors.
Hands‑On Labs
Lab A: Build the skeleton
Create a home page with header/nav/main/footer, one H1, two H2s, an image with alt
, and a call‑to‑action link.
Lab B: Optimize <head>
Add a unique title, meta description, canonical, favicon, and an FAQ JSON‑LD.
Lab C: Image gallery
Add 6 images with descriptive filenames and contextual alt; make non‑critical images lazy‑load.
Lab D: Internal linking
Create a 3‑page mini‑site and connect pages with descriptive anchors; add breadcrumbs.
Lab E (advanced, optional): Multilingual mock with /en/
and /hi/
plus reciprocal hreflang
links.
Checklist
The web platform & HTML basics
Semantic layout & headings; build your first page
<head>
deep dive: title/description/robots/canonicalLinks & images + accessibility
Components: lists, tables, forms (with labels)
Media: images/video
<figure>
; lazy‑loading; CLSInternal linking strategies; breadcrumbs
Mini project #1 review
Structured data (JSON‑LD) overview + FAQ/Breadcrumb markup
Internationalization basics & hreflang overview
Performance primer from HTML perspective
Mini project #2 review
Auditing HTML with a crawler; fixing pitfalls
Writing great titles & descriptions workshop
Accessibility checks (keyboard nav, alt text)