Topic 6.7
SEO Basics for Developers
In one line
Search engines crawl, render and index pages before they rank them; developers control that with robots rules, canonical URLs, sitemaps, clean URLs, semantic HTML and hreflang for other languages.
Think of it like this
A huge library with a robot librarian. The robot walks every corridor following signs (crawling), opens each book to read it (rendering), writes a catalogue card for it (indexing), and when someone asks a question, picks the best cards (ranking). You can put a "staff only" sign on a door (robots.txt), a "don't catalogue this" note in a book (noindex), mark which of three identical copies is the original (canonical), and hand the robot a map of every room (sitemap).
Words you'll meet
New words in this topic, in plain English. Come back here whenever one feels fuzzy.
- SEO
- Search engine optimisation: making pages easy for search engines to find, understand and show.
- Crawling
- A search engine's program visiting pages by following links and downloading them.
- Indexing
- Storing a page in the search engine's database so it can appear in results.
- robots.txt
- A file at the site root that tells crawlers which paths they may visit.
- noindex
- A robots instruction meaning "don't show this page in search results".
- Canonical URL
- The one main address for a page that exists at several addresses.
- Sitemap
- An XML file listing the pages you want search engines to find.
- 301 redirect
- A server reply saying a page has moved permanently to a new address.
- hreflang
- An attribute that tells search engines which language or region a page version is for.
- Search Console
- Google's free tool that shows how your site is crawled, indexed and found.
Step by step
01Follow a page's journey
Every step can fail: a page blocked in robots.txt is never fetched, a page that renders empty without JavaScript may be indexed empty, a noindexed page is dropped, and a duplicate is folded into its canonical.
02Write robots.txt
Allow everything except private or useless areas, and point to the sitemap. Hectal's own robots rules block only /api and /admin.
User-agent: *
Disallow: /admin/
Disallow: /api/
Sitemap: https://ashaskitchen.example/sitemap.xml03Mark pages in the head
A canonical on every page; noindex only on pages that shouldn't appear in search (internal search results, thank-you pages, staging copies).
<!-- normal page -->
<link rel="canonical" href="https://ashaskitchen.example/recipes/pancakes">
<!-- internal search results page -->
<meta name="robots" content="noindex, follow">04List pages in a sitemap
Only canonical, indexable URLs that return 200. Google ignores <priority> and <changefreq>, but uses an accurate <lastmod>.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://ashaskitchen.example/recipes/pancakes</loc>
<lastmod>2026-09-28</lastmod>
</url>
</urlset>05Add language versions
The same block goes on the English and the Hindi page, so each confirms the other.
<link rel="alternate" hreflang="en" href="https://ashaskitchen.example/en/pancakes">
<link rel="alternate" hreflang="hi" href="https://ashaskitchen.example/hi/pancakes">
<link rel="alternate" hreflang="x-default" href="https://ashaskitchen.example/en/pancakes">06Make the body crawlable
Links as <a href>, one <h1>, headings in order, text in HTML rather than in images. Then check the page in Search Console's URL Inspection tool, which shows the rendered HTML Googlebot saw.
Try it yourself
- 1
Noindex the page
In the first example, change the robots content to
noindex, follow. Predict the first two console lines, then run. Then delete the robots meta entirely: what does a page with no robots tag mean? - 2
Break hreflang
Delete the
hreflang="en"line. Predict the last console line. Why would Google distrust this hreflang set? - 3
Fix the links
In the second example, turn the upma
<span>into a real<a href>, give "Coming soon" a real target or make it plain text, and rewrite "Click here" as "Poha with peanuts". Run until every line says crawlable with no vague text.
Code & diagrams
This is a tiny version of what SEO crawlers (and Hectal's own `check:seo` script) do for every page.
Preview
Console
Nothing logged yet.Expected console output
robots: index, follow, max-image-preview:large
Indexable: true
canonical: https://ashaskitchen.example/en/pancakes
hreflang: [ 'en', 'hi', 'x-default' ]
hreflang includes this page: trueCrawlers collect `<a href>` URLs; they don't click elements or run onclick handlers. Link text tells them what the target page is about.
Preview
Console
Nothing logged yet.Expected console output
Egg-free pancakes: crawlable
Crispy dosa: crawlable
Quick upma: NOT crawlable
Coming soon: NOT crawlable
Click here: crawlable (vague text)
h1 count: 1Break it on purpose
Errors are the best teachers. Make each change, read the error, guess what went wrong, then reveal the answer.
Break #1
noindex plus a robots.txt block
Add <meta name="robots" content="noindex"> to /old-sale and also Disallow: /old-sale in robots.txt.
Break #2
A canonical that points everywhere to the home page
A template bug sets <link rel="canonical" href="https://example.com/"> on every page.
Break #3
Staging leaks into search
Deploy a staging copy at staging.example.com with no protection.
Myth vs fact
Myth
robots.txt keeps a page out of Google.
Fact
It stops crawling, not indexing. Use noindex (with crawling allowed) to keep a page out, and authentication to keep it private.
Myth
Google can't read JavaScript sites.
Fact
Googlebot renders JavaScript, but rendering can be delayed and other crawlers may not run it. Server-rendered or static HTML is the reliable choice for content and links.
Myth
SEO is about stuffing keywords into tags.
Fact
Keyword stuffing is ignored or penalised. Clear titles, useful content, crawlable links, fast pages and correct technical signals are what work.
Pro corner
Extra depth for experienced readers. New to this? Skip it for now and come back later.
- ▸
Canonical signals stack:
rel=canonical, redirects, internal links, sitemap inclusion and HTTPS all vote. When they disagree, Google picks its own; Search Console's URL Inspection shows the "user-declared" and the "Google-selected" canonical. - ▸
hreflangcan also be declared in the sitemap (xhtml:linkelements) or in HTTPLinkheaders, which is easier to keep consistent for large sites. Errors such as missing return links appear in third-party SEO crawlers; Google's old International Targeting report was retired. - ▸
JavaScript-rendered pages: links must exist as
<a href>in the rendered DOM; content that appears only after a click, scroll orIntersectionObserverfiring may never be seen. Google's renderer does not scroll; it uses a tall viewport. - ▸
Status codes are SEO signals: soft 404s (a "not found" page that returns 200) waste crawl budget and get flagged; return real 404/410 codes. Redirect chains (A → B → C) slow crawling; point redirects straight at the final URL.
Remember this
- 1
SEO (search engine optimisation) is making pages easy to find, understand and choose in search results. Content quality matters most, but developers own the technical part: if a page can't be crawled, rendered or indexed, nothing else counts. Google's crawler is called Googlebot; it discovers pages through links and sitemaps, downloads them, renders them (it runs JavaScript, but later and with limits) and stores what it understands in the index.
- 2
robots.txtis a text file at the site root (https://example.com/robots.txt) that tells crawlers which paths they may crawl. It controls crawling, not indexing: a blocked URL can still appear in results (with no description) if other sites link to it. It is public and voluntary, so it is not a security tool; never use it to hide private pages. - 3
To keep a page out of the index, use
<meta name="robots" content="noindex">(or theX-Robots-Tag: noindexHTTP header for PDFs and other files). The crawler must be allowed to fetch the page to see this tag, so don't block a noindexed page in robots.txt. Other values:nofollow(don't follow links on this page),noarchive,nosnippet,max-snippet:[n],max-image-preview:large. On individual links,rel="nofollow",rel="ugc"(user-generated content) andrel="sponsored"(paid links) qualify the link. - 4
The same content often lives at several URLs: with and without
www, with tracking parameters (?utm_source=x), with a trailing slash, sorted differently.<link rel="canonical" href="https://example.com/shoes">names the canonical URL, the main version that should be indexed and credited. Use an absolute URL, put one on every page (pointing to itself if it's the original), and make it agree with your sitemap, internal links and redirects. It's a strong hint, not an order. A sitemap is an XML file listing the URLs you want indexed, with<lastmod>dates; one file holds up to 50,000 URLs or 50 MB. Link it from robots.txt and submit it in Google Search Console. - 5
URLs should be readable, lowercase and stable:
/recipes/egg-free-pancakes, not/index.php?id=4821&cat=7. Use hyphens between words (Google treats them as word separators; underscores join words). When a URL must change, send a 301 redirect (permanent) from the old one, so links and ranking move with it. Semantic HTML is SEO too: one clear<h1>, logical headings, real<a href>links (crawlers don't click buttons or runonclick), descriptive link text instead of "click here",alttext on images,<main>,<nav>and<article>. Speed and stability (Google's Core Web Vitals: LCP, INP, CLS) are part of page experience. - 6
If you have the same page in several languages or regions,
hreflanglinks tell search engines which version to show to whom:<link rel="alternate" hreflang="hi" href="https://example.com/hi/">. Values are a language code (en,hi,fr), optionally plus a region (en-IN,en-GB; there is noen-UK). Every version must list all versions including itself, the links must be reciprocal (each page links back), andhreflang="x-default"names the fallback page for everyone else.
Explain it without notes
Describe crawling, rendering and indexing, and what can stop each one.
What's the difference between robots.txt and <meta name="robots" content="noindex">?
What is a canonical URL and when do you need one?
How does hreflang work, and what are its common mistakes?
Why is semantic HTML part of SEO?
Practice
Write a robots.txt for a shop that blocks /cart/ and /checkout/ for every crawler and points to its sitemap at https://bagbazaar.example/sitemap.xml.
Write the head tags for the French version of https://bagbazaar.example/fr/sacs on a site with English (/en/bags) and French pages, with English as the fallback.
Write a JavaScript snippet that logs every <a> on the page that has no href.
Trade-offs
- ↔
Client-side rendering is quick to build but relies on crawlers running JavaScript; server rendering or static generation (what Hectal uses) costs build or server work but gives every crawler complete HTML.
- ↔
Many filter and sort URLs help users but create near-duplicates; canonicalise them or keep them out of links and sitemaps, at the cost of those variants never ranking on their own.
Done when you can
I can explain crawling, rendering, indexing and ranking.
I can write robots.txt and know it doesn't stop indexing.
I can use
noindexcorrectly, with crawling allowed.I put an absolute, self-referencing canonical on every page.
I can write a sitemap and correct reciprocal hreflang links.
I build crawlable links and a clear heading structure.