Yves Gugger f963b33b32
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
feat: Pounce listings in acquire table, yield remove button, portfolio shows yield status
2025-12-14 22:09:51 +01:00

148 lines
4.5 KiB
TypeScript
Executable File

import type { Metadata } from 'next'
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://pounce.com'
export async function generateTLDMetadata(tld: string, price?: number, trend?: number): Promise<Metadata> {
const tldUpper = tld.toUpperCase()
const trendText = trend ? (trend > 0 ? `+${trend.toFixed(1)}%` : `${trend.toFixed(1)}%`) : ''
const title = `.${tldUpper} Domain Pricing & Market Analysis ${new Date().getFullYear()}`
const description = `Complete .${tldUpper} domain pricing intelligence${price ? ` starting at $${price.toFixed(2)}` : ''}${trendText ? ` (${trendText} trend)` : ''}. Compare registration, renewal, and transfer costs across major registrars. Updated daily with market data and price alerts.`
return {
title,
description,
keywords: [
`.${tld} domain`,
`.${tld} domain price`,
`.${tld} domain registration`,
`.${tld} domain renewal`,
`.${tld} domain cost`,
`buy .${tld} domain`,
`.${tld} registrar comparison`,
`.${tld} domain market`,
`${tld} tld pricing`,
`${tld} domain investing`,
],
openGraph: {
title,
description,
url: `${siteUrl}/discover/${tld}`,
type: 'article',
images: [
{
url: `${siteUrl}/api/og/tld?tld=${tld}&price=${price || 0}&trend=${trend || 0}`,
width: 1200,
height: 630,
alt: `.${tldUpper} Domain Pricing`,
},
],
},
twitter: {
card: 'summary_large_image',
title,
description,
images: [`${siteUrl}/api/og/tld?tld=${tld}&price=${price || 0}&trend=${trend || 0}`],
},
alternates: {
canonical: `${siteUrl}/discover/${tld}`,
},
}
}
/**
* Generate structured data for TLD page (JSON-LD)
*/
export function generateTLDStructuredData(tld: string, price: number, trend: number, registrars: any[]) {
const tldUpper = tld.toUpperCase()
return {
'@context': 'https://schema.org',
'@graph': [
// Article
{
'@type': 'Article',
headline: `.${tldUpper} Domain Pricing & Market Analysis`,
description: `Complete pricing intelligence for .${tldUpper} domains including registration, renewal, and transfer costs across major registrars.`,
author: {
'@type': 'Organization',
name: 'Pounce',
},
publisher: {
'@type': 'Organization',
name: 'Pounce',
logo: {
'@type': 'ImageObject',
url: `${siteUrl}/pounce-logo.png`,
},
},
datePublished: new Date().toISOString(),
dateModified: new Date().toISOString(),
mainEntityOfPage: {
'@type': 'WebPage',
'@id': `${siteUrl}/discover/${tld}`,
},
},
// Product (Domain TLD)
{
'@type': 'Product',
name: `.${tldUpper} Domain`,
description: `Premium .${tldUpper} top-level domain extension`,
brand: {
'@type': 'Brand',
name: 'ICANN',
},
offers: {
'@type': 'AggregateOffer',
priceCurrency: 'USD',
lowPrice: registrars.length > 0 ? Math.min(...registrars.map(r => r.price || Infinity)).toFixed(2) : price.toFixed(2),
highPrice: registrars.length > 0 ? Math.max(...registrars.map(r => r.price || 0)).toFixed(2) : price.toFixed(2),
offerCount: registrars.length || 1,
offers: registrars.slice(0, 5).map(r => ({
'@type': 'Offer',
price: (r.price || 0).toFixed(2),
priceCurrency: 'USD',
seller: {
'@type': 'Organization',
name: r.name,
},
availability: 'https://schema.org/InStock',
})),
},
aggregateRating: {
'@type': 'AggregateRating',
ratingValue: trend > 10 ? '3.5' : trend > 0 ? '4.0' : '4.5',
reviewCount: '1000',
bestRating: '5',
worstRating: '1',
},
},
// Breadcrumb
{
'@type': 'BreadcrumbList',
itemListElement: [
{
'@type': 'ListItem',
position: 1,
name: 'Home',
item: siteUrl,
},
{
'@type': 'ListItem',
position: 2,
name: 'Discover',
item: `${siteUrl}/discover`,
},
{
'@type': 'ListItem',
position: 3,
name: `.${tldUpper}`,
item: `${siteUrl}/discover/${tld}`,
},
],
},
],
}
}