You are working on a Next.js (App Router) + TypeScript project.
The website currently has SEO issues flagged by Bing Webmaster Tools:
- Page titles are too short
- Meta descriptions are too short
- Many pages have duplicate titles
- Many pages have duplicate meta descriptions
- IndexNow is not configured
Your task is to implement a complete SEO system that resolves all these issues.
Create a utility:
/lib/seo.ts
export const SITE_NAME = "Gray Cup"
export function generateTitle(title: string) {
const full = `${title} | ${SITE_NAME}`
if (full.length > 60) {
return full.slice(0, 57) + "..."
}
return full
}
export function generateDescription(text: string) {
if (text.length > 160) {
return text.slice(0, 157) + "..."
}
if (text.length < 140) {
return text + " Explore global sourcing, exports, wholesale and retail coffee, tea and spices from Gray Cup."
}
return text
}Every page must export metadata using the helpers.
Example:
app/page.tsx
import { generateTitle, generateDescription } from "@/lib/seo"
export const metadata = {
title: generateTitle("Global Coffee, Tea & Spice Exporter"),
description: generateDescription(
"Gray Cup exports premium coffee beans, tea and spices worldwide while building infrastructure for farms and D2C brands."
),
}Each page must have unique metadata.
Examples:
Title:
Global Coffee, Tea & Spice Exporter | Gray Cup
Description:
Gray Cup exports premium coffee beans, tea and spices worldwide for wholesale, retail and international buyers.
Title:
Premium Coffee, Tea & Spice Products | Gray Cup
Description:
Explore globally sourced coffee beans, teas and spices from Gray Cup available for wholesale, export and retail buyers.
Title:
About Gray Cup Coffee & Spice Export Company
Description:
Learn about Gray Cup, a global sourcing and export company specializing in coffee, tea and spices for international markets.
For dynamic pages like:
/products/[slug]
Use generateMetadata().
Example:
import { generateTitle, generateDescription } from "@/lib/seo"
export async function generateMetadata({ params }) {
const product = await getProduct(params.slug)
return {
title: generateTitle(`${product.name} Coffee Beans Export`),
description: generateDescription(
`Buy ${product.name} green coffee beans sourced globally by Gray Cup. Available for wholesale, retail and international export.`
)
}
}This ensures no duplicate titles/descriptions.
Create:
app/sitemap.ts
Example:
import { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://yourdomain.com',
lastModified: new Date(),
},
{
url: 'https://yourdomain.com/products',
lastModified: new Date(),
},
{
url: 'https://yourdomain.com/about',
lastModified: new Date(),
}
]
}Output:
/sitemap.xml
Create:
app/robots.ts
import { MetadataRoute } from 'next'
export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
allow: '/',
},
sitemap: 'https://yourdomain.com/sitemap.xml',
}
}Generate key:
openssl rand -hex 16
Example key:
a8d9e21c3b4f5a67123b4c5d6e7f8a9b
Create file:
/public/a8d9e21c3b4f5a67123b4c5d6e7f8a9b.txt
Contents:
a8d9e21c3b4f5a67123b4c5d6e7f8a9b
Accessible at:
https://yourdomain.com/a8d9e21c3b4f5a67123b4c5d6e7f8a9b.txt
app/api/indexnow/route.ts
export async function POST(req: Request) {
const urls = await req.json()
const payload = {
host: "yourdomain.com",
key: "YOUR_INDEXNOW_KEY",
urlList: urls
}
await fetch("https://api.indexnow.org/indexnow", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
})
return Response.json({ success: true })
}Whenever:
- product added
- page created
- blog published
Call:
POST /api/indexnow
with:
[
"https://yourdomain.com/new-page"
]This makes Bing index the page within minutes.
On homepage:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Gray Cup",
"url": "https://yourdomain.com",
"description": "Global exporter of coffee, tea and spices."
}
</script>Agent must ensure:
- Titles 50–60 characters
- Descriptions 140–160 characters
- No duplicate metadata
- Sitemap generated
- Robots.txt configured
- IndexNow active
- Metadata system reusable
After deployment:
- Bing warnings disappear
- Pages index within minutes
- Titles/descriptions optimized for CTR
- Search visibility improves