fix: Remove build-time API calls to prevent timeouts
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
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
This commit is contained in:
@ -1,8 +1,57 @@
|
|||||||
import { MetadataRoute } from 'next'
|
import { MetadataRoute } from 'next'
|
||||||
import { POPULAR_TLDS, SITE_URL } from '@/lib/seo'
|
import { POPULAR_TLDS, SITE_URL } from '@/lib/seo'
|
||||||
|
|
||||||
// This generates a dynamic sitemap including all TLD pages
|
// All TLDs for sitemap - statically defined to avoid build-time API calls
|
||||||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
const ALL_TLDS = [
|
||||||
|
// Generic TLDs
|
||||||
|
'com', 'net', 'org', 'info', 'biz', 'name', 'pro',
|
||||||
|
// New gTLDs - Popular
|
||||||
|
'io', 'ai', 'co', 'app', 'dev', 'xyz', 'online', 'store', 'shop', 'tech',
|
||||||
|
'site', 'club', 'fun', 'space', 'website', 'live', 'news', 'blog', 'cloud',
|
||||||
|
'digital', 'agency', 'studio', 'media', 'design', 'solutions', 'consulting',
|
||||||
|
'group', 'team', 'work', 'zone', 'center', 'network', 'systems', 'services',
|
||||||
|
// Finance
|
||||||
|
'finance', 'money', 'bank', 'insurance', 'invest', 'capital', 'fund', 'trading',
|
||||||
|
'exchange', 'cash', 'tax', 'accountant', 'financial', 'investments',
|
||||||
|
// Tech
|
||||||
|
'technology', 'software', 'computer', 'hosting', 'email', 'mobile', 'phone',
|
||||||
|
'web', 'page', 'link', 'click', 'download', 'stream',
|
||||||
|
// Business
|
||||||
|
'business', 'company', 'enterprises', 'inc', 'ltd', 'llc', 'gmbh', 'holdings',
|
||||||
|
'ventures', 'partners', 'associates', 'global', 'international', 'world',
|
||||||
|
// Lifestyle
|
||||||
|
'life', 'health', 'fitness', 'beauty', 'fashion', 'style', 'luxury', 'vip',
|
||||||
|
'cool', 'lol', 'wtf', 'fail', 'win', 'best', 'top', 'plus', 'one',
|
||||||
|
// Crypto
|
||||||
|
'crypto', 'nft', 'web3', 'blockchain', 'bitcoin', 'defi', 'dao', 'token', 'eth',
|
||||||
|
// Creative
|
||||||
|
'art', 'photography', 'photos', 'pics', 'gallery', 'graphics', 'video', 'film',
|
||||||
|
'music', 'band', 'audio', 'radio', 'tv', 'show', 'movie', 'theater',
|
||||||
|
// Food & Drink
|
||||||
|
'restaurant', 'cafe', 'coffee', 'bar', 'pub', 'wine', 'beer', 'pizza', 'kitchen',
|
||||||
|
// Real Estate
|
||||||
|
'house', 'homes', 'property', 'properties', 'estate', 'land', 'apartments', 'condos',
|
||||||
|
// Travel
|
||||||
|
'travel', 'tours', 'holiday', 'vacation', 'flights', 'hotel', 'hotels', 'resort',
|
||||||
|
// Education
|
||||||
|
'education', 'academy', 'school', 'college', 'university', 'training', 'courses',
|
||||||
|
// Sports
|
||||||
|
'sport', 'football', 'soccer', 'golf', 'tennis', 'racing', 'bike', 'run', 'fit',
|
||||||
|
// ccTLDs - Europe
|
||||||
|
'ch', 'de', 'at', 'uk', 'co.uk', 'fr', 'es', 'it', 'nl', 'be', 'pl', 'pt', 'se',
|
||||||
|
'no', 'fi', 'dk', 'ie', 'cz', 'sk', 'hu', 'ro', 'gr', 'ru', 'ua',
|
||||||
|
// ccTLDs - Americas
|
||||||
|
'us', 'ca', 'mx', 'br', 'ar', 'cl', 'co', 'pe', 'vc',
|
||||||
|
// ccTLDs - Asia Pacific
|
||||||
|
'jp', 'cn', 'kr', 'in', 'sg', 'hk', 'tw', 'au', 'nz', 'ph', 'my', 'id', 'th', 'vn',
|
||||||
|
// ccTLDs - Other
|
||||||
|
'za', 'ae', 'il', 'sa', 'ng', 'ke', 'eg',
|
||||||
|
// Popular alternatives
|
||||||
|
'cc', 'tv', 'me', 'ws', 'la', 'sx', 'gg', 'to', 'fm', 'am', 'im',
|
||||||
|
]
|
||||||
|
|
||||||
|
// This generates a static sitemap - no API calls during build
|
||||||
|
export default function sitemap(): MetadataRoute.Sitemap {
|
||||||
const baseUrl = SITE_URL
|
const baseUrl = SITE_URL
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
|
|
||||||
@ -64,39 +113,13 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// Fetch all TLDs from API for dynamic TLD pages
|
// TLD pages - statically generated
|
||||||
let tldPages: MetadataRoute.Sitemap = []
|
const tldPages: MetadataRoute.Sitemap = ALL_TLDS.map(tld => ({
|
||||||
|
|
||||||
try {
|
|
||||||
// Try to fetch TLDs from the API
|
|
||||||
const response = await fetch(`${baseUrl}/api/v1/tld/overview?limit=100`, {
|
|
||||||
next: { revalidate: 86400 }, // Revalidate daily
|
|
||||||
})
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
const data = await response.json()
|
|
||||||
const tlds = data.tlds || []
|
|
||||||
|
|
||||||
tldPages = tlds.map((tld: { tld: string }) => ({
|
|
||||||
url: `${baseUrl}/tld/${tld.tld.toLowerCase()}`,
|
|
||||||
lastModified: now,
|
|
||||||
changeFrequency: 'daily' as const,
|
|
||||||
priority: 0.7,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to fetch TLDs for sitemap:', error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// If API failed, use popular TLDs as fallback
|
|
||||||
if (tldPages.length === 0) {
|
|
||||||
tldPages = POPULAR_TLDS.map(tld => ({
|
|
||||||
url: `${baseUrl}/tld/${tld}`,
|
url: `${baseUrl}/tld/${tld}`,
|
||||||
lastModified: now,
|
lastModified: now,
|
||||||
changeFrequency: 'daily' as const,
|
changeFrequency: 'daily' as const,
|
||||||
priority: 0.7,
|
priority: 0.7,
|
||||||
}))
|
}))
|
||||||
}
|
|
||||||
|
|
||||||
return [...staticPages, ...tldPages]
|
return [...staticPages, ...tldPages]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,21 +15,9 @@ interface TldData {
|
|||||||
registry?: string | null
|
registry?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTldData(tld: string): Promise<TldData | null> {
|
// No build-time API calls - data is fetched client-side
|
||||||
try {
|
function getTldData(_tld: string): TldData | null {
|
||||||
const response = await fetch(`${SITE_URL}/api/v1/tld/${tld}`, {
|
return null // Data loaded client-side in TldDetailClient
|
||||||
next: { revalidate: 3600 }, // Revalidate every hour
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return response.json()
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to fetch TLD data:', error)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate static params for popular TLDs
|
// Generate static params for popular TLDs
|
||||||
|
|||||||
Reference in New Issue
Block a user