Sitemap & SEO Configuration
Overview
Your Next.js application now generates a dynamic XML sitemap automatically during the build process, which is essential for Google Search Console and other search engines.
Whatβs Generated
Sitemap.xml
- Location:
https://patttterns.com/sitemap.xml - Auto-generated: Yes, during
npm run build - Includes:
- Homepage (priority: 1.0, weekly updates)
- All pattern pages from Notion database (priority: 0.8, monthly updates)
- Last modified timestamps
Robots.txt
- Location:
https://patttterns.com/robots.txt - Purpose: Instructs search engines about sitemap location and crawling rules
- Current settings: Allows all bots, points to sitemap
Files Created
- src/app/sitemap.ts - Dynamic sitemap generator
- public/robots.txt - Robots directives
How It Works
Automatic Generation
// src/app/sitemap.ts
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
// Fetches all pages from Notion database
// Generates sitemap entry for each pattern
// Returns XML that Next.js automatically formats
}
The sitemap is:
- β Generated at build time
- β
Served at
/sitemap.xml - β Automatically formatted as valid XML by Next.js
- β Includes all dynamic routes with proper priorities
Setup in Google Search Console
- Go to: Google Search Console
- Select your domain:
patttterns.net - Navigate to: Sitemaps (left sidebar)
- Add new sitemap:
https://patttterns.com/sitemap.xml - Submit: Google will crawl and index your patterns
Sitemap Structure
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://patttterns.com</loc>
<lastmod>2026-01-31</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://patttterns.com/grid-pattern-abc123</loc>
<lastmod>2026-01-31</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<!-- ... more pattern pages ... -->
</urlset>
Priority Settings
| Page | Priority | Change Frequency | Rationale |
|---|---|---|---|
| Homepage | 1.0 | Weekly | Entry point for all content |
| Pattern Pages | 0.8 | Monthly | Content doesnβt change frequently |
Verification
Local Development
# Build the project
npm run build
# The sitemap is automatically generated at .next/server/app/sitemap.xml
Production
# After deployment, verify sitemap is accessible
curl https://patttterns.com/sitemap.xml
# Should return valid XML with all your patterns
Dynamic Updates
The sitemap is regenerated on each build:
- β New patterns automatically included
- β Removed patterns automatically excluded
- β Last modified dates updated
- β οΈ Requires new deployment for changes to be live
Additional SEO Features
Robots.txt
Accessible at https://patttterns.com/robots.txt and includes:
- Allow all bots to crawl
- Reference to sitemap location
- No disallowed paths
Meta Tags (Already Configured)
In src/app/layout.tsx:
- Title tags
- Meta descriptions
- Open Graph images
- Twitter cards
Troubleshooting
Sitemap shows 0 URLs
- β
Check
NOTION_HOMEPAGE_IDis set in.env.local - β Verify Notion API key has access to database
- β Check console output during build for errors
Google Search Console reports errors
- β Verify all URLs in sitemap are accessible
- β Check that pages return 200 status codes
- β Ensure trailing slashes are consistent
Next Steps
- Submit to Google Search Console (see setup steps above)
- Monitor coverage in Google Search Console
- Check indexing status for your patterns
- Review search queries to optimize content
- Track impressions & clicks over time