SEO Check Tool
seo-in-nextjs includes a built-in tool to audit your project’s SEO implementation.
-
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())\""}} -
Run the check from your terminal:
Terminal window npm run check-seoTerminal window yarn check-seoTerminal window pnpm check-seo
What it checks
Section titled “What it checks”The SEO check tool analyzes four areas of your project:
1. Page Metadata
Section titled “1. Page Metadata”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
2. Robots Configuration
Section titled “2. Robots Configuration”Verifies how your site handles robot crawling rules:
- Static file: Checks if
robots.txtexists in thepublicfolder - Manual generation: Detects if you’re using
robots.tsorrobots.jswith custom logic - Library utility: Identifies usage of the
robotsTxtfunction from the library
3. Sitemap Configuration
Section titled “3. Sitemap Configuration”Examines your sitemap implementation:
- Static file: Checks if
sitemap.xmlexists in thepublicfolder - Manual generation: Detects if you’re using
sitemap.tsorsitemap.jswith custom logic - Library utility: Identifies usage of the
sitemapXmlfunction from the library
4. Improvement Suggestions
Section titled “4. Improvement Suggestions”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.txtinstead of static files - Configuring sitemap generation for better crawlability
- Leveraging library utilities for consistency