On-Page SEO: How to Optimize for Robots and Readers

Ryan Law
Ryan Law is the Director of Content Marketing at Ahrefs. Ryan has 13 years experience as a writer, content strategist, team lead, marketing director, VP, CMO, and agency founder. He's helped dozens of companies improve their content marketing and SEO, including Google, Zapier, GoDaddy, Clearbit, and Algolia. He's also a novelist and the creator of two content marketing courses.
Article Performance
Data from Ahrefs

The number of websites linking to this post.

This post's estimated monthly organic search traffic.

    On-page SEO is the process of optimizing blog posts and website pages to improve their search rankings.

    If you want better rankings for your content, you need to do two core things:

    • Create helpful, interesting content, and
    • Help Google understand your page and show it to more people.

    Balancing these two ideas is the goal of on-page SEO. Let’s learn how to optimize your content.

    This is the one non-negotiable requirement of on-page SEO: to rank, you have to match intent.

    The goal of a search engine is to surface content that satisfies a user’s search. No amount of keywords, metadata, and internal links will help an article rank if it doesn’t give the user what they’re looking for.

    But there’s a positive side: doing a better job at matching intent can dramatically boost the rankings of your content. Here’s what happened to one of our blog posts after we did a better job of matching the searcher’s intent:

    A keyword like “how to make espresso at home without a machine” makes it easy to guess the intent behind the search. The information is right there, in the keyword: searchers want to learn how to make great coffee, at home, without an espresso machine.

    But the intent behind “espresso” is harder to infer from the keyword alone. Does the searcher want to buy coffee? Do they want a simple definition or a detailed process for making it? Should we write about expensive espresso machines or DIY alternatives like a mocha pot?

    This information isn’t in the keyword, but it is in the search results. If an article is ranking well for a particular keyword, it’s probably giving searchers what they want. The existing search results can provide a roadmap to help you understand and match intent.

    Most of the top results for “espresso” focus on definitions and simple explainers.

    To identify search intent, look at the top-ranking results on Google and identify the three Cs of search intent:

    • Content type: what is the dominant type of content? Is it a blog post, product page, video, or something else?
    • Content format: are all the top results how-to guides? Or lists, or reviews, or comparisons?
    • Content angle: what approach do the top-ranking articles take? Do they all talk about the “best”, or “cheapest,” or “for beginners”?

    In most situations, your content should take a similar approach to the content that already ranks well (similar, but not identical—more on that below). Once you’re happy that you’re giving searchers what they want, it’s time for the nitty-gritty of on-page SEO.


    Some search results can contain several different types of intent (the SERP for “kiwi” includes the bird, the fruit, the airline company, and the Harry Styles song).

    If you want to use data to help work out which intent you should target, try the “Identify intents” feature in Ahrefs.

    Head to Keywords explorer, enter your keyword, scroll to the SERP overview and hit the Identify intents button:

    Here you can see that an estimated 49% of the traffic goes to basic information about kiwi fruits. But there’s another angle that might be worth taking: 19% of the estimated traffic cares specifically about the health benefits of eating Kiwi fruit.

    On-page SEO is limited to improvements we can make directly on our page. Anything that helps with search performance but can’t be changed directly on our page is called off-page SEO. Backlinks, for example, play a crucial role in SEO, but they are outside of the scope of on-page SEO.

    Further reading

    If a reader clicks on an article titled How to brew perfect espresso, there’s a good chance they’ll end up frustrated if the article misses out on important steps, like grinding beans or dosing your basket.

    Well-optimized content is exhaustive: it covers all the steps of the process, lists all the resources the reader needs, and answers all the questions that need answering. It delivers on its promises and leaves no important gaps in its information.

    Exhaustive content is great for readers, but it also increases the likelihood that your article will rank for more keywords. In the image below, we can see an article called How to brew espresso ranking for 712 keywords, including terms like how to make espresso at home and espresso shot:

    Importantly, being exhaustive doesn’t always mean writing something very long. Content can be thorough, helpful, and short—it depends on the topic. If the reader is looking for a quick definition or—dare I say it—a recipe, thousands of words of writing can sometimes get in the way.

    Include relevant sub-topics

    An important part of being exhaustive is covering relevant sub-topics. Keyword research can be a big help here: in Ahrefs, head to Keywords explorer, enter your target keyword, and you can quickly find hundreds of related keywords to consider covering, including:

    • Terms match: keywords that contain all of the terms of your target keyword (“how to make espresso martini”).
    • Questions: relevant keywords phrased as questions (“how to make espresso at home”)
    • Also rank for: keywords that the top 10 ranking pages also rank for (“what is espresso”)
    • Also talk about: keywords frequently mention by top-ranking articles (“coffee maker”)

    You can also read the top-ranking content for inspiration, like this section on moka pot espresso:

    Or you can use Site explorer to look at the different keywords each article already ranks for. From this selection, it might be worth covering how to make espresso without an espresso machine:

    You can run this process for multiple articles using the Content Gap report. In the screenshot below, I’m comparing our article (highlighted) with three competing articles:

    Hit “Show keywords” and you can immediately see keywords that you don’t rank for, but your competitors do. In this example, we should probably add a section talking about the type of coffee that works best in espresso machines:

    And perhaps most important of all: use your common sense.

    If you know from experience that a particular subtopic is crucial to mention, but can’t see any keywords or existing articles to justify it, go ahead and add it anyway. Information that helps the reader is information that helps search rankings.

    A note on on-page optimization tools

    On-page SEO tools can be helpful for identifying sub-topics—with one important caveat.

    If you take all of their recommendations at face value, it’s very easy to create content that’s a nonsensical mish-mash of everyone else’s content, or worse—horribly and obviously keyword-stuffed.

    I like to use on-page optimization tools as an extra source of possible topics to include in my content outline. If my article is exhaustive, I don’t worry about whether it scores a B- or an A+.

    Link to relevant resources, internally and externally

    To create exhaustive content without ballooning your page to ten thousand words, it’s a great idea to link from your page to other resources your reader would find helpful.

    If you have them, link to relevant pages on your website. Internal links help visitors navigate your website and increase the odds that they’ll find the information they need—but there are benefits for SEO too.

    Internal linking helps search engines find all the pages on your website, understand what each page is about, and highlight the pages you believe to be the most important.

    External linking is also a good idea whenever you want to cite information from elsewhere on the web, or send the reader to an authoritative third-party source of information.

    A clear, logical structure makes it much easier for readers and robots alike to understand what your page is about and find relevant information on it.

    Organize the flow with relevant headers

    HTML header tags (things that look like this—<h2>Header goes here</h2>—in your page’s code) help break content up into logical, easily skimmed sections. You can use the Ahrefs toolbar to quickly see how header tags are used on a page:

    There are no hard-and-fast rules for header tags, but as a general guide, try to:

    • Use one <h1> tag and keep it the same as your <title> tag (this helps to make the core topic of your page super clear).
    • Use <h2> tags for your page’s main points.
    • Use <h3> tags (and beyond) for sections that support your main points, like examples or related ideas.

    If you’re worried about how many keywords to include in your headers, don’t: match the intent of the keyword, write exhaustively, and you’ll naturally include plenty of relevant keywords throughout your headers.

    As an added benefit, good use of subheadings will improve the readability of your content, making it easier to see, at a glance, what each section is about:

    For longer content, it can be helpful to include on-page navigation to let the reader easily jump to relevant headers—like we do for our longer articles:

    Include visual interest with images and lists

    Nobody likes a wall of text. Bullet point lists and images can make your content less intimidating and easier to scan, encouraging readers to stick around for longer.

    Any images you include can also rank in Google Image search, and in special search features called Image packs. In both cases, sharing descriptive information about your images can send more traffic your way. That means:

    • Using descriptive file names
    • Including alt text
    • Providing a caption for the image

    We do this regularly at Ahrefs; as a result, our blog images appear in image packs for 524 keywords:

    Optimize for featured snippets

    Featured snippets are special search results that sit above the main organic results in a place known as “position zero”:

    In searches where Google thinks visitors will benefit from a short, direct answer, they’ll often choose an excerpt from a high-ranking page to show.

    Plenty of queries have a featured snippet, so it’s worth trying to win them. To see which keywords have a featured snippet, head to Keywords Explorer, paste your list of keywords, and hit the SERP features toggle to show only those keywords that have a featured snippet in the search results:

    You can also use Site Explorer to find opportunities to optimize your existing pages for featured snippets. Paste in your website URL, use the SERP features selector to show only keywords that have a featured snippet in the SERP that your website doesn’t currently rank for:

    For this website, we can see 3,034 coffee-related keywords with a featured snippet. Time to get optimizing!

    There’s no guaranteed way to win the featured snippet, but it helps to:

    • Match the existing snippet format (commonly paragraph, list, table, or video)
    • Define your topic succinctly in two to three sentences
    • Keep your content objective and fact-based, and avoid first-person language
    • Featured Snippets: A Shortcut to the Top of Google

    Use a short, descriptive URL

    Logical structure also extends to your page’s URL: it’s helpful to use a short, descriptive URL structure highlighting the core topic of the page.

    As Google explained in its SEO starter guide: “Parts of the URL can be displayed in search results as breadcrumbs, so users can also use the URLs to understand whether a result will be useful for them.”

    Adding your keyword to your URL won’t magically boost search performance, but it will build the reader’s confidence that your page is relevant to their query.

    (And make your life easier when you come to update your old content and can’t remember what the target keyword was.)

    There’s a secret weapon that most SEOs and content marketers forget to use: being interesting. Pit two heavily-optimized articles against each other, and the one that tells a better story, offers original data, or shares a strong opinion, is the one that will earn the clicks.

    Fight for clicks with your title and meta description

    Even if you can get your article to a top spot in the SERP, you still need to convince the reader to actually click and read your article. More often than not, that hinges on having a great title:

    • Keep them short—under 70 characters is best to avoid truncation.
    • Match search intent – tell searchers you have what they want.
    • Harness the curiosity gap (but don’t clickbait).
    • Include the keyword, or a close variation if it makes more sense.
    • Include the year for topics that demand freshness.
    • Do something to stand out—show a sense of humour, or respond to other articles in the SERP.

    The same principles apply to your page’s meta description. Google has a habit of rewriting most meta descriptions, but in the event that they don’t, write something that piques your reader’s interest and encourages them to click through.

    Hook the reader’s interest with a killer introduction

    Your page introduction is the last barrier between you and a happy, satisfied reader. Your first few sentences have a big impact on whether your visitor will bounce or read on, so make your first impression count.

    You can hook the reader’s interest with a short, relevant story or personal experience—or simply answer the reader’s question, right there in the introduction:

    Today, more than ever before, Google values content that shows first-person experience of the subject matter.

    Here’s what Google had to say in a recent update to their quality rater guidelines:

    “Does content also demonstrate that it was produced with some degree of experience, such as with actual use of a product, having actually visited a place or communicating what a person experienced? There are some situations where really what you value most is content produced by someone who has first-hand, life experience on the topic at hand.”


    When Cyrus Shepherd explored the relationship between different on-page features and gains/losses during recent Google updates, the strongest positive correlation came from first-person pronouns and first-person experience:

    In other words, using language like “I tested…” or “In my experience…” was correlated with gains in Google search visibility.

    There are many caveats to be made: this is a small sample size, this is correlation and not causation, and these are not direct ranking factors. But it does seem to suggest a positive relationship between first-person experience and improved search visibility.

    The easiest way to demonstrate first-person experience is to write about subjects you know well. For example, Chris from our blog team has years of experience running SEO at agencies at in-house companies, so he can write authoritatively on a topic like A Beginner’s Guide to SEO Reporting.

    But there are on-page elements that can help too:

    • Include expert quotes. When your expertise isn’t enough to be authoritative on the subject, seek out quotes and feedback from people who are experts (especially in fields that require specific certifications and qualifications, like healthcare or accountancy).
    • Get hands-on with your topic. If you’re writing about brewing espresso, actually go and brew a few hundred shots. Reviewing free CRM software? Download, install, and spend a few hours with each option. If you aren’t willing to go to these lengths, there’s a good chance you’ll be beaten by someone who will.
    • Show evidence. Prove to readers (and Google) that you did the thing you’re talking about: add experience to your author bio, and include photographs and videos of your experience.

    We’re in the era of AI content. Anyone can publish a long, detailed article on virtually any topic, all for a few bucks and a few minutes of effort. So how can we optimize our content to stand out?

    Whatever you want to call it—information gain, uniqueness, value-add—the answer is straightforward: offer something that can’t be found anywhere else:

    • Cover subtopics no one else has covered: “The most overlooked factor in great espresso…”
    • Share an opinion or personal experience: “Machine espresso is overrated because…”
    • Run an experiment: “I brewed all my coffee with an Aeropress for a month…”
    • Collect original data: “I surveyed twenty baristas and found…”
    • Interview subject matter experts: “I spoke to a World Brewer’s Cup champion…”

    Wirecutter regularly shares strong opinions in their product comparison articles, like this recommendation for the best espresso machine:

    This is great for the visitor and—arguably—does a better job at matching their intent: do they really need ten recommendations if they’re only going to buy one espresso machine?

    Lastly, there are a few technical tweaks that can improve page performance.

    Get rich results with schema markup

    Rich results are search results that give searchers extra information about a page, like product ratings or recipe details. Not every type of search is eligible to show rich results, but for those that are, rich results help drive extra clicks to your page.

    To be eligible for rich snippets, you need to apply a simple code called schema markup. Learn how in our guide:

    Make it fast and mobile-friendly

    To rank your pages, Google will also take into account a set of “page experience signals.” These include (but are not limited to):

    • Core Web Vitals (CWV) (in other words, whether the page is fast enough and stable).
    • Security (whether the page connects via HTTPS).
    • Mobile-friendliness (Google uses the mobile version of your pages for indexing and ranking).
    • Avoiding intrusive interstitials and dialogs.

    These are problems that can be spotted on individual pages but usually need to be solved at the site level. Check out our guides to learn more:

    Final thoughts

    On-page SEO can often help content climb a few ranks higher in the search results, but don’t be disheartened if it doesn’t pay off immediately.

    Search results change. Information changes. Your experience and opinions change. In some cases, even the intent behind the search can change (“llm” used to refer solely to a legal degree—now, it usually refers to large language model).

    If rankings don’t improve, it’s worth trying to update or strengthen your content again. We do this all the time on the Ahrefs blog, and we’ve had good results from updating or even completely rewriting content.

    Below, you can see an example—organic traffic multiplied after a simple update:

    Traffic increase as a result of updating the content

    Article Performance
    Data from Ahrefs

    The number of websites linking to this post.

    This post's estimated monthly organic search traffic.