What Search Engines Read in Your HTML
Search engines download your HTML, run its JavaScript, and use what they find to decide what a page is about and how to show it in results. Good markup does not make thin content rank, but it removes obstacles: a clear title, real links, described images and a stable layout all help a crawler and a visitor understand the page.
This guide goes through the HTML that matters, with examples you can copy. It ends with the popular rules of thumb that Google has said it does not use, so you can stop spending time on them.
1. A Unique, Descriptive Title
The <title> is the main source for the clickable headline in search results and the text in the browser tab. Give every page its own title that says what the page is, with the most specific words first and your site name last.
<title>Lemon Drizzle Cake Recipe | Ana's Kitchen</title>
Google may rewrite a title that is vague, repeated across pages or stuffed with keywords, often using the page's main heading instead. There is no fixed character limit: long titles are simply cut off when displayed, so keeping them to roughly 50 to 60 characters is a readability habit, not a ranking rule.
2. A Meta Description Written for People
The meta description is not used for ranking, but it is often shown as the snippet under your title, so it influences whether someone clicks. Summarize the specific page in a sentence or two.
<meta name="description" content="A moist lemon loaf with a crisp sugar glaze. Takes 15 minutes to prepare and keeps for three days.">
Google frequently writes its own snippet from the page text when that matches a search better, which is another reason to make the visible content clear.
3. A Canonical Link for Duplicate URLs
The same page is often reachable at several addresses: with and without a trailing slash, with tracking parameters, or over both HTTP and HTTPS. A canonical link names the preferred one:
<link rel="canonical" href="https://example.com/recipes/lemon-drizzle-cake/">
Use the full absolute URL. Search engines treat the canonical as a strong hint rather than a command, so keep your internal links and sitemap pointing at the same address.
4. The Robots Meta Tag, Only When You Need It
Pages are indexed and their links followed by default, so most pages need no robots tag at all. Add one to keep a page out of search results, such as a thank-you page or internal search results:
<meta name="robots" content="noindex">
A crawler can only obey noindex if it is allowed to fetch the page. If the same URL is blocked in robots.txt, the tag is never seen and the URL can still appear in results.
5. Headings That Outline the Page
Headings tell readers and search engines how the content is organized. Use an <h1> for the topic of the page and <h2> and <h3> for its sections, in order, choosing the level for structure rather than for font size:
<h1>Lemon Drizzle Cake</h1>
<h2>Ingredients</h2>
<h2>Method</h2>
<h3>Making the glaze</h3>
<h2>Storage</h2>
Screen-reader users jump between headings to navigate, so a logical outline is also an accessibility requirement. Skipping from <h2> to <h4> makes that harder.
6. Real Links with Descriptive Text
Search engines discover pages by following links, and they only follow <a> elements that have an href. Navigation built from clickable <div> or <span> elements is invisible to them, and to keyboard users too.
<!-- Crawlable, and clear out of context -->
<a href="/recipes/lemon-drizzle-cake/">Lemon drizzle cake recipe</a>
<!-- Not followed: no href -->
<span onclick="location.href='/recipes/lemon-drizzle-cake/'">Click here</span>
<!-- Paid and user-submitted links -->
<a href="https://partner.example/" rel="sponsored">Our baking partner</a>
<a href="https://forum.example/post/12" rel="ugc">Reader's variation</a>
Link text should describe the destination. "Lemon drizzle cake recipe" tells both a person and a search engine what is behind the link; "click here" tells neither.
7. Images with Alt Text and Dimensions
The alt attribute describes an image for screen-reader users and for image search. The width and height attributes let the browser reserve space before the image loads, which stops the page from jumping around. Below the first screen, loading="lazy" delays images until they are needed:
<!-- The main image near the top: load it early -->
<img src="lemon-cake.webp" width="1200" height="800" fetchpriority="high"
alt="A sliced lemon drizzle cake with white sugar glaze on a wooden board">
<!-- Images further down the page -->
<img src="step-3-glaze.webp" width="800" height="600" loading="lazy"
alt="Glaze being poured over the warm cake">
Do not lazy-load the largest image at the top of the page. It is usually the element browsers measure for loading speed, and delaying it makes the page feel slower.
8. Language, Encoding and Viewport
Three lines in every page tell browsers and crawlers how to read it:
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Google indexes the mobile version of pages, so a page without a viewport tag, which renders as a shrunken desktop layout on phones, works against you. The lang attribute helps search engines and screen readers handle the language correctly.
9. Semantic Structure
Elements such as <header>, <nav>, <main>, <article> and <footer> mark out the parts of a page. They do not give a ranking boost on their own, but they make the main content unambiguous, help assistive technology and keep your markup readable. Use them because they describe the page, not as a ranking trick.
10. Structured Data in JSON-LD
Structured data describes the page in a format machines read reliably, and it can make a page eligible for rich results such as recipe cards or review stars. JSON-LD in a script tag is the format Google recommends:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Recipe",
"name": "Lemon Drizzle Cake",
"image": "https://example.com/images/lemon-cake.webp",
"author": { "@type": "Person", "name": "Ana Lopez" },
"prepTime": "PT15M",
"cookTime": "PT45M",
"recipeIngredient": ["225 g butter", "225 g sugar", "4 eggs", "2 lemons"]
}
</script>
Everything in the markup must match what visitors can see on the page, and eligibility is not a guarantee of a rich result. Check your markup with Google's Rich Results Test. Some types have been restricted: since 2023, FAQ rich results appear only for well-known government and health sites, and how-to rich results are no longer shown.
11. Speed and Layout Stability
Google's Core Web Vitals measure how a page feels to use: Largest Contentful Paint (loading, good at 2.5 seconds or less), Interaction to Next Paint (responsiveness, good at 200 milliseconds or less; it replaced First Input Delay in March 2024) and Cumulative Layout Shift (visual stability, good at 0.1 or less). They are one signal among many, but several fixes live in your HTML:
- Give images and embeds
widthandheightso the layout does not shift. - Load the main image early with
fetchpriority="high"and lazy-load the rest. - Add
deferto scripts that are not needed to show the first screen:<script src="app.js" defer></script>.
Myths You Can Ignore
- The meta keywords tag. Google has ignored
<meta name="keywords">for ranking since at least 2009. It only tells competitors which words you are targeting. - "Only one H1 per page." Google has said that several
<h1>elements are not a problem. A single, clear page heading is still a sensible convention for readers. - "Valid HTML ranks higher." Search engines handle imperfect HTML well. Validate because broken markup can break layouts, forms and accessibility, not for a ranking bonus.
- Exact character counts. Title and description lengths affect how much is displayed, not how a page ranks.
- noarchive. Google removed cached pages from search in 2024 and no longer uses this rule.
A Quick Checklist
- Unique
<title>and meta description on every page - A canonical link on pages reachable at more than one URL
- One clear page heading and a logical heading order
- Navigation and content links built from
<a href> - Alt text, width and height on images; lazy loading below the first screen
lang,charsetand viewport in every page- Structured data that matches the visible content, tested before release
You can check several of these at once by pasting a page into the HTML validator: it reports missing titles, lang attributes, viewport tags and alt text, along with structural errors.
Related Articles
Conclusion
Search-friendly HTML is mostly ordinary good HTML: honest titles and descriptions, a clear outline, real links, described images and a page that loads without jumping around. Get those right on every page and spend the rest of your effort on the content itself, which is what people are searching for.
Check Your Page
Paste a page into the HTML validator to find a missing title, lang attribute, viewport tag or alt text.
Check your HTML โ