Skip to content

SEO Check Tool

seo-in-nextjs includes a built-in tool to audit your project’s SEO implementation.

  1. Add the following script to your package.json:

    package.json
    {
    "scripts": {
    "check-seo": "node --input-type=module -e \"import('@dlcastillop/seo-in-nextjs/scripts').then(m => m.checkSeo())\""
    }
    }
  2. Run the check from your terminal:

    Terminal window
    npm run check-seo

The SEO check tool analyzes four areas of your project:

Identifies the metadata status for each page in your application:

  • Pages without metadata: Routes that are missing metadata configuration
  • Pages with manual metadata: Routes using Next.js native metadata export
  • Pages using genPageMetadata: Routes leveraging the library’s metadata utility

Verifies how your site handles robot crawling rules:

  • Static file: Checks if robots.txt exists in the public folder
  • Manual generation: Detects if you’re using robots.ts or robots.js with custom logic
  • Library utility: Identifies usage of the robotsTxt function from the library

Examines your sitemap implementation:

  • Static file: Checks if sitemap.xml exists in the public folder
  • Manual generation: Detects if you’re using sitemap.ts or sitemap.js with custom logic
  • Library utility: Identifies usage of the sitemapXml function from the library

Based on the analysis, the tool provides actionable recommendations to enhance your SEO setup, such as:

  • Adding metadata to pages that are missing it
  • Implementing dynamic robots.txt instead of static files
  • Configuring sitemap generation for better crawlability
  • Leveraging library utilities for consistency