Overview
The Pengrafic template includes built-in SEO optimization features using Next.js 14’s Metadata API. This includes support for Open Graph tags, Twitter Cards, sitemaps, and robots.txt configuration.Metadata Configuration
Global Metadata
Global metadata is configured insrc/app/layout.tsx:
src/app/layout.tsx
title- Default page title for the entire sitedescription- Default meta descriptionicons- Favicon and shortcut icon pathsverification- Google Search Console verification code
Page-Specific Metadata
Each page can override the global metadata. Example fromsrc/app/page.tsx:
src/app/page.tsx
Open Graph Tags
Basic Open Graph Setup
Open Graph tags make your site shareable on Facebook, LinkedIn, and other social platforms:Open Graph Image Requirements
- Recommended size: 1200 x 630 pixels
- Aspect ratio: 1.91:1
- Format: JPG, PNG, or WebP
- Max file size: 8 MB
- Minimum size: 200 x 200 pixels
Open Graph Types
Twitter Card Tags
Summary Card
Summary Large Image Card
- Recommended size: 1200 x 628 pixels
- Aspect ratio: 2:1
- Format: JPG, PNG, WebP, or GIF
- Max file size: 5 MB
Sitemap Configuration
The template includes a static sitemap atpublic/sitemap.xml:
public/sitemap.xml
Dynamic Sitemap (Advanced)
For dynamic content, createapp/sitemap.ts:
app/sitemap.ts
Fetching Dynamic Routes
app/sitemap.ts
Robots.txt Configuration
The robots.txt file is located atpublic/robots.txt:
public/robots.txt
Dynamic Robots.txt (Advanced)
Createapp/robots.ts for dynamic configuration:
app/robots.ts
Common Robots.txt Patterns
Block specific paths:SEO Best Practices
export const metadata: Metadata = {
description: "Discover how to optimize your Next.js site for SEO. Learn about metadata, Open Graph, and more. Get started today!",
};
import Image from "next/image";
<Image
src="/images/hero.jpg"
alt="Professional web development services for businesses"
width={1200}
height={600}
priority
/>
export default function Page() {
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'Organization',
name: 'Pengrafic',
url: 'https://pengrafic.com',
logo: 'https://pengrafic.com/logo.png',
contactPoint: {
'@type': 'ContactPoint',
telephone: '+51-992-870-423',
contactType: 'customer service',
},
};
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>
{/* Page content */}
</>
);
}
Testing SEO
Tools to Test Your SEO
-
Google Search Console
- Monitor search performance
- Submit sitemaps
- Check for crawl errors
-
PageSpeed Insights
- Test page speed
- Get optimization recommendations
- Check Core Web Vitals
-
Rich Results Test
- Validate structured data
- Preview rich snippets
- Check for errors
-
Facebook Sharing Debugger
- Test Open Graph tags
- Preview social shares
- Clear cache
-
Twitter Card Validator
- Test Twitter Cards
- Preview card appearance
- Validate metadata
Manual Testing
View page source:Common SEO Issues
Monitoring SEO Performance
Set Up Google Search Console
- Go to Google Search Console
- Add your property (domain or URL prefix)
- Verify ownership using the verification code in your metadata
- Submit your sitemap URL
- Monitor performance in the dashboard
Key Metrics to Track
- Organic traffic - Visitors from search engines
- Click-through rate (CTR) - Percentage of impressions that result in clicks
- Average position - Where your pages rank in search results
- Core Web Vitals - Page experience metrics (LCP, FID, CLS)
- Indexed pages - Number of pages in Google’s index
- Crawl errors - Issues preventing proper indexing
Advanced SEO Features
Multi-language Support
App Links (Deep Linking)
RSS Feed
Createapp/feed.xml/route.ts: