DeepFrontend
Practice ArenaBlogSign in
Go Pro
DeepFrontend

Interview-grade learning paths and hands-on practice for mid-to-senior engineers. Master internals, patterns, and system architecture with runnable code.

All systems operational

Core Courses

  • -JavaScript Internals
  • -React Reconciliation
  • -TypeScript rigor
  • -Next.js Caching
  • -Node.js Event Loop
  • -System Design
  • -Web Security
  • -CSS & Page Layouts

Explore

  • Learning Paths
  • Practice Arena
  • Pricing Options
  • HTML Sitemap

Resources

  • Privacy Policy
  • Terms of Service
  • Email Support

© 2026 DeepFrontend. All rights reserved.

Expert learning environments for web engineering teams.

Home/HTML/SEO Basics
beginner15 min read·Updated Jul 2026

SEO Basics

Search engines read HTML, not visual layout. This topic covers the foundational HTML that determines whether a page is indexable and understandable at all — titles, meta tags, headings, and links — before any technical SEO tooling.

htmlseometa-tagssearch-engines

Knowledge Check

3 questions · pass at 70%

0/3
easymcq

1. Which of these is a direct search ranking factor, versus one that mainly affects click-through rate on the results page?


Interview Questions

3 questions

Cheatsheet

Download-ready reference
Cheatsheet
Essential <head> tags:
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Unique, descriptive, <60 chars</title>
  <meta name="description" content="~155-160 chars, genuine summary">
  <link rel="canonical" href="...">

Heading structure: one <h1> per page = the page's topic (not the site brand)

Links:
  Descriptive anchor text, never "click here"
  Internal links help crawlers discover + understand site structure

Images: alt="describes the image content" (empty alt="" only if purely decorative)

robots.txt (site root, NOT a security mechanism):
  User-agent: *
  Disallow: /admin/
  Sitemap: https://example.com/sitemap.xml

Per-page indexing control:
  <meta name="robots" content="noindex, follow">   don't index, but follow links
  <meta name="robots" content="noindex, nofollow"> don't index, don't follow links

JS rendering & SEO:
  Content only in client-rendered JS → indexed slower (2nd pass) or not at all (non-Google crawlers)
  Fix: SSR/SSG for anything that matters for ranking

Rule of thumb: good SEO fundamentals ≈ correct, meaningful, server-rendered HTML.

Related topics

Semantic HTMLRequest Lifecycle (browser → server)Technical SEO (structured data, sitemaps, Open Graph)Pro

On this page

15m
Knowledge CheckInterview QuestionsCheatsheet

Concept#

Search engines crawl HTML (and increasingly execute JavaScript, but with real caveats — see below). Everything an engine knows about a page's topic, importance, and relationship to other pages starts with the raw markup. Good SEO fundamentals are mostly "write correct, meaningful HTML" — the same practices that help accessibility and maintainability also help search ranking, because both are ultimately about making a document's meaning legible to something that isn't a human eyeballing the rendered page.

The essential <head>#

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Closures in JavaScript — A Deep Dive | Frontend Mastery</title>
  <meta
    name="description"
    content="Learn how JavaScript closures work under the hood, common mistakes, and how they show up in real React bugs."
  />
  <link rel="canonical" href="https://example.com/topic/javascript.closures" />
</head>
  • <title> — the single highest-weight on-page SEO signal, and what's shown as the clickable headline in search results. Should be unique per page, include the primary topic, and stay under ~60 characters before search engines truncate it. Page Title | Site Name is a common, reasonable pattern.
  • <meta name="description"> — doesn't directly affect ranking, but is frequently shown as the result snippet, so it directly affects click-through rate. Aim for a genuine, specific summary under ~155-160 characters, not keyword stuffing.
  • <link rel="canonical"> — tells search engines which URL is the "real" one when the same content is reachable at multiple URLs (with/without trailing slash, with tracking query params, paginated duplicates). Prevents duplicate-content dilution of ranking signal.
  • <meta name="viewport"> — not SEO-labeled, but mobile-friendliness is a ranking factor, and this is required for a page to render correctly on mobile at all.

One <h1>, meaningful heading hierarchy#

<h1>Closures in JavaScript</h1>
<h2>What is a closure?</h2>
<h3>The lexical environment</h3>
<h2>Common mistakes</h2>

Search engines use heading structure to understand a page's topic outline — similar to how they'd read a table of contents. This is the same practice covered in Semantic HTML, and it's not a coincidence that accessibility and SEO overlap this heavily: both are about making structure legible to something reading the markup rather than viewing rendered pixels.

Links: the graph search engines actually crawl on#

<!-- Descriptive anchor text, not "click here" -->
<a href="/topic/closures">Learn about closures</a>
 
<!-- Not this -->
<a href="/topic/closures">click here</a> to learn about closures.

Search engines follow <a href> links to discover new pages — this is literally how crawling works, it's a graph traversal starting from known pages. Anchor text is also a ranking signal for the linked-to page — "click here" tells a crawler nothing about what's on the other end; "Learn about closures" does. Internal linking between related content (see relatedTopics in this very site's topic pages) helps search engines understand site structure and distributes ranking signal between related pages.

Images need alt text — for accessibility and SEO#

<img src="closure-diagram.png" alt="Diagram showing a function's scope chain retaining a reference to its outer variable" />

alt text is read by screen readers (accessibility) and indexed by image search / used as a fallback signal for what the image depicts (SEO) — same attribute, two audiences, one correct practice. An empty alt="" is correct only for purely decorative images that carry no information.

robots.txt and meta robots#

# robots.txt at the site root
User-agent: *
Disallow: /admin/
Allow: /
Sitemap: https://example.com/sitemap.xml
<!-- Per-page: don't index this page, but do follow its links -->
<meta name="robots" content="noindex, follow" />

robots.txt is a request, not a security boundary — it tells well-behaved crawlers what not to crawl, but doesn't prevent access and doesn't stop a URL from being indexed if it's linked to from elsewhere (use meta robots noindex or a password/auth wall for that). Common use: excluding admin panels, internal search result pages, or duplicate filtered/sorted product listing variations from being indexed.

JavaScript-rendered content and crawling#

Google's crawler executes JavaScript (a headless Chromium-based renderer), but with real caveats: rendering happens in a second pass, sometimes hours to days after the initial crawl (content only in the initial HTML is indexed faster and more reliably), and other search engines (Bing has partial JS support, many others effectively none) don't render JS at all. Practical implication: content critical to a page's core topic and ranking should ideally be present in the server-rendered/initial HTML, not exclusively injected client-side after a JS bundle loads — which is exactly what frameworks like Next.js's Server Components and SSR/SSG solve.


Common Mistakes#

1. Missing or duplicate <title> across pages#

Every indexable page needs a unique, descriptive title. A site where every page has the same <title>Home | MySite</title> (a very common CMS default) gives search engines nothing to distinguish pages by.

2. <h1> used for the site logo/name instead of the page's topic#

<!-- Wrong: every page's <h1> is just the site name -->
<h1>My Company</h1>
<p>Article about closures...</p>

The <h1> should describe this specific page's content, not the site brand (that belongs in the header/logo, not necessarily as an <h1>, and definitely not repeated identically on every page as the only <h1>).

3. "Click here" / "read more" anchor text#

Tells neither users scanning the page nor search engines crawling it anything about the destination.

4. Blocking crawlers accidentally via robots.txt#

# Wrong — a leftover staging-environment robots.txt deployed to production
User-agent: *
Disallow: /

A shockingly common real incident: a Disallow: / meant for a staging environment gets deployed to production and silently deindexes the entire site over the following weeks. Always verify robots.txt after any deploy pipeline change.

5. Content only rendered client-side, with nothing meaningful in the initial HTML#

<!-- Search engines see roughly this on first crawl -->
<div id="root"></div>
<script src="/bundle.js"></script>

If the primary content only appears after JS execution and hydration, indexing is slower and less reliable, and non-Google crawlers may never see it at all. Server-render (or statically generate) anything that matters for ranking.

6. Keyword stuffing in meta description#

<!-- Wrong -->
<meta name="description" content="closures javascript closures tutorial learn closures js closures guide" />

Meta description doesn't directly affect ranking (unlike <title> and content itself) — it affects click-through rate on the search results page. Stuffed, unreadable descriptions get skipped by users and may be replaced by Google with an auto-generated snippet anyway.


Best Practices#

  • Unique, descriptive <title> per page, under ~60 characters, primary keyword near the front.
  • One <h1> per page describing that page's specific content, not the site brand.
  • Descriptive anchor text for every link, internal and external.
  • alt text on every meaningful image; empty alt="" only for purely decorative ones.
  • Server-render or statically generate primary content rather than relying solely on client-side JS rendering.
  • Set rel="canonical" whenever the same content is reachable at multiple URLs.

Further Resources#

  • Google Search Central — SEO Starter Guide
  • MDN — SEO
  • web.dev — Discovery: crawling and indexing and web.dev SEO learn path
  • Google Search Central — robots.txt introduction
  • Google Search Central — JavaScript SEO basics

  • Keep robots.txt and meta robots intentional — verify them after every deploy pipeline or environment change.
  • Submit a sitemap (sitemap.xml, referenced from robots.txt and Search Console) so crawlers can discover pages beyond what they find by following links.
  • Ahrefs Blog — Free SEO fundamentals content