On-Page SEO
On-page SEO involves optimizing individual web pages to rank higher and earn more relevant traffic. Learn how to optimize meta tags, content, headings, and internal structure for better search visibility.
Meta descriptions provide a brief summary of your page content. While not a direct ranking factor, they heavily influence click-through rates from search results.
Meta Description Best Practices
- Keep it between 150-160 characters
- Include your target keyword naturally
- Write compelling copy that encourages clicks
- Make it unique for each page
- Include a call-to-action when appropriate
- Accurately describe the page content
Bad Example
Welcome to our website. Click here for more information.Too vague, no keywords, not compelling
Good Example
Master the MERN stack with our comprehensive tutorial. Learn MongoDB, Express, React, and Node.js through hands-on projects and clear examples. Start building today!Descriptive, includes keywords, has CTA, under 160 chars
// Next.js metadataexport const metadata: Metadata = {title: 'React Hooks Tutorial',description: 'Learn React Hooks with practical examples. Master useState, useEffect, useContext, and custom hooks to build powerful React applications.',}
Proper heading hierarchy helps search engines understand your content structure and improves accessibility.
Heading Hierarchy Rules
- H1: One per page, main topic/page title
- H2: Major sections of content
- H3: Subsections under H2
- H4-H6: Further subsections as needed
- Never skip heading levels (don't go H1 → H3)
- Include keywords naturally in headings
Pro Tip
Your H1 should match or closely relate to your page title (meta title). This reinforces to search engines what the page is about and creates consistency for users.
High-quality, optimized content is the foundation of good SEO. Search engines reward pages that provide value to users.
1. Keyword Research & Placement
- Research keywords with tools like Google Keyword Planner, Ahrefs, or Ubersuggest
- Target one primary keyword per page
- Include primary keyword in: title, H1, first paragraph, URL
- Use semantic variations and related terms naturally
- Avoid keyword density over 2-3% (keyword stuffing penalty)
2. Content Length & Depth
- Longer content (1500+ words) tends to rank better for competitive keywords
- Prioritize quality over length—don't add fluff
- Cover topics comprehensively
- Break content into scannable sections
3. Content Freshness
- Regularly update existing content
- Add new information as topics evolve
- Include publish and update dates
- Fresh content signals relevance to search engines
4. Readability
- Use short paragraphs (2-3 sentences)
- Include bullet points and numbered lists
- Add images, code examples, and diagrams
- Use simple language (avoid jargon when possible)
- Target 8th-grade reading level for broad audiences
Example: Keyword-Optimized Paragraph
React Hooks revolutionized how developers write React components. With hooks like useState anduseEffect, you can add state and lifecycle features to functional React components without converting them to classes. This React Hooks tutorial will teach you how to use hooks effectively in your projects.
Primary keyword "React Hooks" used naturally, with semantic variations and related terms
Internal links connect your pages together, helping search engines discover content and understand your site structure while distributing page authority.
Internal Linking Best Practices
- Link to related content within your site
- Use descriptive anchor text (not "click here")
- Link from high-authority pages to newer pages
- Keep important pages within 3 clicks from homepage
- Fix broken internal links promptly
- Use follow links (avoid nofollow for internal links)
Bad Anchor Text
Learn more about React in <a href="/react">this article</a>.
<a href="/tutorial">Click here</a> for the tutorial.Good Anchor Text
Learn more about <a href="/react">React fundamentals</a>.
Read our <a href="/tutorial">React Hooks tutorial</a>.// Next.js internal linking with proper anchor textimport Link from 'next/link'export default function BlogPost() {return (<article><p>Before diving into hooks, make sure you understand{' '}<Link href="/react/components">React component basics</Link>.</p><p>After mastering useState, learn about{' '}<Link href="/react/useeffect">useEffect for side effects</Link>.</p>{/* Related articles section */}<aside><h3>Related Topics</h3><ul><li><Link href="/react/context">React Context API</Link></li><li><Link href="/react/custom-hooks">Creating Custom Hooks</Link></li></ul></aside></article>)}
Optimized images improve page speed, user experience, and can rank in image search results.
1. Alt Text (Alternative Text)
Alt text describes images for screen readers and search engines. It also displays if the image fails to load.
- Be descriptive and specific
- Include keywords when relevant (naturally)
- Keep it under 125 characters
- Don't start with "Image of..." or "Picture of..."
2. File Names
Use descriptive, keyword-rich file names:
3. File Size & Format
- Compress images (use tools like TinyPNG, ImageOptim)
- Use modern formats: WebP, AVIF for better compression
- Target under 100KB for web images
- Use SVG for logos and icons
- Implement lazy loading for below-the-fold images
// Next.js Image component (automatic optimization)import Image from 'next/image'export default function Component() {return (<Imagesrc="/react-hooks-diagram.jpg"alt="React Hooks useState and useEffect diagram"width={800}height={600}loading="lazy" // Lazy load for better performancequality={85} // Adjust quality (default 75)/>)}// HTML with responsive images<imgsrc="/image-800.jpg"srcset="/image-400.jpg 400w,/image-800.jpg 800w,/image-1200.jpg 1200w"sizes="(max-width: 600px) 400px, (max-width: 1000px) 800px, 1200px"alt="Responsive React tutorial screenshot"loading="lazy"/>
Clean, descriptive URLs are better for users and search engines. They should be easy to read and understand.
SEO-Friendly URL Best Practices
- Use hyphens (-) to separate words, not underscores
- Keep URLs short and descriptive (3-5 words ideal)
- Include your target keyword
- Use lowercase letters only
- Avoid special characters and parameters when possible
- Create a logical hierarchy
Poor URL Structure
Too complex, inconsistent, includes unnecessary parameters
Good URL Structure
Clean, descriptive, keyword-rich, hierarchical
URL Structure Hierarchy Example
Next.js File-Based Routing
Next.js automatically creates SEO-friendly URLs based on your file structure. The file app/tutorials/react-hooks/page.tsx becomes/tutorials/react-hooks.