A CLI tool to generate and manage Next.js metadata for better SEO.
- 🚀 Simple Setup: One command to set up a comprehensive metadata configuration
- 🔄 Centralized Management: All your metadata in one file
- 🧩 Variable System: Define site-wide values once, use them everywhere
- 📱 App Router Compatible: Works with Next.js App Router
- 🔄 Automatic Layout Update: Integrates with your existing layout files
# Install globally
npm install -g next-seo-metadata
# OR run directly with npx
npx next-seo-metadata
# Navigate to your Next.js project
cd your-nextjs-project
# Initialize the metadata configuration
npx next-seo-metadata
This will:
- Create a
next-metadata.js
file in your project root - Prompt you for basic information about your site
- Optionally update your layout file to use the new metadata configuration
Once initialized, you can simply edit the next-metadata.js
file to update your metadata. The file is structured with:
- A
siteConfig
object containing all your variable data - A
metadata
object that uses the values fromsiteConfig
// Site configuration (edit this part)
const siteConfig = {
name: "Your Site Name",
url: "https://yoursite.com",
description: "Your site description",
// ...more configuration
};
// Metadata object (uses siteConfig values)
const metadata = {
title: {
default: siteConfig.name,
template: `%s | ${siteConfig.name}`,
},
// ...more metadata
};
export default metadata;
export { siteConfig };
- Single Source of Truth: All your metadata in one place
- DRY Principle: Define values once, use them throughout your metadata
- Better Organization: Clear structure separating configuration from implementation
- Easy Updates: Change values in one place, updates everywhere
This project is licensed under the MIT License - see the LICENSE file for details.