On-Page SEO
On-page SEO refers to the optimization of individual web pages to improve their search engine rankings and attract more relevant traffic. While technical SEO focuses on the infrastructure that makes your site crawlable and indexable, on-page SEO focuses on the content and HTML source code of each page. It is the practice of ensuring that every page clearly communicates its topic, relevance, and value to both search engines and users.
On-page SEO is one of the most directly controllable aspects of search optimization. Unlike off-page factors such as backlinks, which depend on external sites, on-page elements are entirely within your control. This makes on-page SEO a natural fit for quality engineering — every element can be validated, measured, and enforced through automated checks.
Title Tags
The title tag (<title>) is arguably the single most important on-page SEO element. It appears as the clickable headline in search engine results pages (SERPs), in browser tabs, and when pages are shared on social media (as a fallback when Open Graph tags are not present). A well-crafted title tag directly influences both rankings and click-through rates.
Best practices for title tags:
- Length: Keep title tags between 50 and 60 characters. Google typically displays the first 50-60 characters (approximately 580 pixels wide). Titles longer than this will be truncated with an ellipsis, potentially cutting off important information.
- Uniqueness: Every page on your site should have a unique title tag. Duplicate titles confuse search engines about which page to rank for a given query and make it harder for users to distinguish between pages in search results.
- Keyword placement: Place your primary keyword near the beginning of the title tag. Search engines give slightly more weight to words that appear earlier, and users scanning results will see the most important terms first.
- Brand name: Include your brand name, typically at the end of the title separated by a dash or pipe character. For example: "On-Page SEO Guide — CodeFrog".
- Readability: Write for humans first, search engines second. The title should accurately describe the page content and compel users to click. Avoid keyword stuffing, which makes titles unreadable and can trigger search engine penalties.
Meta Descriptions
The meta description is a brief summary of a page's content that appears below the title in search results. While Google has confirmed that meta descriptions are not a direct ranking factor, they significantly influence click-through rates, which indirectly affects SEO performance. A compelling meta description acts as advertising copy for your page in search results.
Best practices for meta descriptions:
- Length: Keep meta descriptions between 150 and 160 characters. Google displays approximately 155-160 characters (about 920 pixels wide) on desktop. Descriptions longer than this will be truncated.
- Compelling copy: Write meta descriptions as a call to action. Tell users what they will find on the page and why they should click. Use active language and include a value proposition.
- Uniqueness: Like title tags, every page should have a unique meta description. Duplicate descriptions provide no additional information to users or search engines.
- Include the target keyword: When a user's search query matches words in the meta description, Google bolds those words in the search results, making your listing more visually prominent.
- Avoid quotes: Google truncates meta descriptions at double quotation marks in the HTML. If you need quotes, use HTML entities (
") instead.
Note that Google sometimes chooses to display a different snippet from your page content instead of the meta description you provided. This typically happens when Google believes a different section of content is more relevant to the user's specific query. Writing a strong meta description increases the likelihood that Google will use it.
Heading Hierarchy
HTML heading elements (<h1> through <h6>) create a hierarchical structure for your content. This hierarchy serves three purposes: it helps search engines understand the topical structure of your page, it improves accessibility for screen reader users who navigate by headings, and it makes content more scannable for all users.
Rules for a proper heading hierarchy:
- Single H1: Each page should have exactly one
<h1>element. The H1 is the primary heading of the page and should clearly describe the main topic. It is typically similar to (but not necessarily identical to) the title tag. - Logical nesting: Headings should follow a logical hierarchy without skipping levels. An
<h2>should be followed by an<h3>(not an<h4>). Think of headings like an outline: H2 elements are main sections, H3 elements are subsections within those sections, and so on. - Descriptive text: Each heading should describe the content that follows it. Avoid generic headings like "Section 1" or headings that are used purely for visual styling. If you need to change the visual size of text, use CSS rather than inappropriate heading levels.
- Do not use headings for styling: Headings exist for document structure, not visual formatting. Using an
<h3>because it looks the right size, even though the document structure calls for an<h2>, hurts both SEO and accessibility.
CodeFrog validates heading hierarchy as part of its SEO analysis, checking for the presence of a single H1, proper nesting order, and skipped heading levels. This automated check catches common issues like pages with no H1, multiple H1 elements, or headings that jump from H2 to H4.
Image Alt Text
The alt attribute on images serves multiple critical purposes: it provides alternative text for screen reader users who cannot see the image, it is displayed when an image fails to load, and it helps search engines understand the content and context of images. Google Images is a significant source of traffic for many websites, and alt text is the primary way Google understands what an image depicts.
Best practices for alt text:
- Be descriptive: Describe what the image shows in concrete, specific terms. "A developer reviewing code on a laptop with a code review tool showing three warnings" is better than "image" or "photo."
- Be concise: Aim for 125 characters or fewer. Screen readers may cut off very long alt text, and overly verbose descriptions slow down the browsing experience for assistive technology users.
- Include keywords naturally: If the image is relevant to a target keyword, include that keyword in the alt text, but only if it describes the image accurately. Never stuff keywords into alt text that do not relate to the image content.
- Decorative images: For purely decorative images that add no informational content (visual flourishes, background patterns), use an empty alt attribute (
alt="") to tell screen readers to skip the image. - Do not start with "Image of" or "Photo of": Screen readers already announce that the element is an image. Starting alt text with "Image of" is redundant and wastes character space.
Internal Linking Strategy
Internal links are hyperlinks that point from one page on your site to another page on the same site. They serve three important functions: they help users navigate your site, they help search engines discover and crawl your pages, and they distribute link equity (ranking power) throughout your site.
A strong internal linking strategy includes:
- Contextual links: Link to related content within the body of your pages where the context is relevant. These are the most valuable internal links because they signal topical relationships to search engines.
- Descriptive anchor text: Use anchor text that describes the destination page. "Learn about technical SEO fundamentals" is far better than "click here" for both users and search engines. The anchor text helps search engines understand what the linked page is about.
- Hierarchical structure: Create a logical site hierarchy where the homepage links to main category pages, which link to subcategory pages, which link to individual content pages. This creates a clear "link pyramid" that distributes authority effectively.
- Fix broken links: Broken internal links waste crawl budget, create poor user experiences, and lose the link equity that would have been passed to the destination page. Regularly audit your site for broken links.
- Reasonable link count: While there is no strict limit, an excessive number of links on a single page can dilute the value passed to each linked page and overwhelm users. Focus on linking to the most relevant and important pages.
URL Structure
URL structure affects both user experience and search engine optimization. A well-structured URL communicates the page's topic and its place in the site hierarchy at a glance.
Best practices for SEO-friendly URLs:
- Readable and descriptive: URLs should be human-readable and describe the page content.
/quality-engineering/seo/on-page-seois better than/qe/s/opsor/page?id=4523. - Use hyphens, not underscores: Google treats hyphens as word separators but treats underscores as word joiners.
on-page-seois read as three separate words;on_page_seomight be read as one word. - Lowercase: Use lowercase letters in URLs. Some servers treat uppercase and lowercase URLs as different pages, which can create duplicate content issues.
- Short and focused: Keep URLs as short as practical while still being descriptive. Remove unnecessary stop words and filler. Shorter URLs tend to perform slightly better in search results and are easier for users to share and remember.
- Reflect site hierarchy: Use directory structure to indicate the page's position in the site hierarchy.
/quality-engineering/seo/on-page-seoclearly shows that this page belongs to the SEO section of the quality engineering guide.
Content Quality Signals
Beyond the technical HTML elements, search engines evaluate the quality of your content through various signals:
- Comprehensiveness: Does the page thoroughly cover its topic? Pages that address a topic in depth, covering related subtopics and answering likely follow-up questions, tend to rank higher than thin pages that barely scratch the surface.
- Originality: Is the content original, or is it copied or lightly rewritten from other sources? Search engines actively detect and devalue duplicate or near-duplicate content.
- Freshness: For topics where recency matters (news, technology, trends), search engines favor recently published or updated content. Regular content updates signal that the information is current and maintained.
- E-E-A-T: Experience, Expertise, Authoritativeness, and Trustworthiness. Google's quality rater guidelines emphasize these signals. Content should demonstrate real-world experience and expertise, especially for topics that can affect health, finances, or safety (known as "Your Money or Your Life" topics).
- User engagement: While Google has been cautious about confirming specific engagement metrics as ranking factors, pages that satisfy user intent — meaning users do not return to search results to try a different result — tend to maintain or improve their rankings over time.
Resources
- Google Search Central: SEO Starter Guide — Google's official guide to on-page optimization best practices
- Ahrefs: On-Page SEO Guide — Detailed guide covering every aspect of on-page optimization with examples