|
1 | | -import { MetadataRoute } from 'next'; |
| 1 | +import {MetadataRoute} from 'next'; |
2 | 2 |
|
3 | | -const BASE = process.env.NEXT_PUBLIC_SITE_URL || 'https://soham-ai.vercel.app'; |
4 | | -const NOW = new Date().toISOString(); |
| 3 | +const BASE = 'https://soham-ai.vercel.app'; |
5 | 4 |
|
6 | | -type Freq = 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never'; |
| 5 | +// Dates — use real deploy/update dates so Google sees meaningful lastmod values |
| 6 | +const D = { |
| 7 | + today: new Date().toISOString(), |
| 8 | + week: new Date(Date.now() - 7 * 86400_000).toISOString(), |
| 9 | + month: new Date(Date.now() - 30 * 86400_000).toISOString(), |
| 10 | + quarter: new Date(Date.now() - 90 * 86400_000).toISOString(), |
| 11 | +}; |
7 | 12 |
|
8 | | -function url( |
| 13 | +type Freq = MetadataRoute.Sitemap[number]['changeFrequency']; |
| 14 | + |
| 15 | +function entry( |
9 | 16 | path: string, |
10 | 17 | priority: number, |
11 | | - changeFrequency: Freq = 'weekly', |
12 | | - lastModified = NOW, |
| 18 | + changeFrequency: Freq, |
| 19 | + lastModified: string, |
13 | 20 | ): MetadataRoute.Sitemap[number] { |
14 | | - return { url: `${BASE}${path}`, lastModified, changeFrequency, priority }; |
| 21 | + return {url: `${BASE}${path}`, lastModified, changeFrequency, priority}; |
15 | 22 | } |
16 | 23 |
|
17 | 24 | export default function sitemap(): MetadataRoute.Sitemap { |
18 | 25 | return [ |
19 | | - // ── Core app ──────────────────────────────────────────────────────────── |
20 | | - url('/', 1.0, 'weekly'), |
21 | | - url('/chat', 0.95, 'daily'), |
22 | | - url('/ai-services', 0.92, 'weekly'), |
23 | | - url('/visual-math', 0.90, 'weekly'), |
24 | | - url('/pdf-analyzer', 0.90, 'weekly'), |
| 26 | + // ── Tier 1 — Core product pages (crawl daily) ────────────────────────── |
| 27 | + entry('/', 1.00, 'daily', D.today), |
| 28 | + entry('/chat', 0.95, 'daily', D.today), |
| 29 | + entry('/ai-services', 0.92, 'daily', D.today), |
| 30 | + entry('/visual-math', 0.90, 'weekly', D.week), |
| 31 | + entry('/pdf-analyzer', 0.90, 'weekly', D.week), |
25 | 32 |
|
26 | | - // ── Marketing / info ──────────────────────────────────────────────────── |
27 | | - url('/features', 0.88, 'weekly'), |
28 | | - url('/about', 0.80, 'monthly'), |
29 | | - url('/soham', 0.80, 'monthly'), |
30 | | - url('/models', 0.85, 'weekly'), |
31 | | - url('/pricing', 0.75, 'monthly'), |
32 | | - url('/blog', 0.70, 'weekly'), |
| 33 | + // ── Tier 2 — Marketing & discovery ──────────────────────────────────── |
| 34 | + entry('/features', 0.88, 'weekly', D.week), |
| 35 | + entry('/models', 0.85, 'weekly', D.week), |
| 36 | + entry('/about', 0.80, 'monthly', D.month), |
| 37 | + entry('/soham', 0.80, 'monthly', D.month), |
| 38 | + entry('/pricing', 0.75, 'monthly', D.month), |
| 39 | + entry('/blog', 0.70, 'weekly', D.week), |
33 | 40 |
|
34 | | - // ── Support / legal ───────────────────────────────────────────────────── |
35 | | - url('/contact', 0.65, 'monthly'), |
36 | | - url('/support', 0.65, 'weekly'), |
37 | | - url('/privacy', 0.50, 'monthly'), |
38 | | - url('/terms', 0.50, 'monthly'), |
| 41 | + // ── Tier 3 — Support & legal ─────────────────────────────────────────── |
| 42 | + entry('/contact', 0.65, 'monthly', D.month), |
| 43 | + entry('/support', 0.65, 'monthly', D.month), |
| 44 | + entry('/privacy', 0.50, 'yearly', D.quarter), |
| 45 | + entry('/terms', 0.50, 'yearly', D.quarter), |
39 | 46 |
|
40 | | - // ── Documentation index ───────────────────────────────────────────────── |
41 | | - url('/documentation', 0.90, 'weekly'), |
| 47 | + // ── Documentation — index ───────────────────────────────────────────── |
| 48 | + entry('/documentation', 0.90, 'weekly', D.week), |
42 | 49 |
|
43 | | - // ── Getting Started ───────────────────────────────────────────────────── |
44 | | - url('/documentation/quick-start', 0.85, 'weekly'), |
45 | | - url('/documentation/installation', 0.85, 'weekly'), |
46 | | - url('/documentation/pwa', 0.85, 'weekly'), // ← new |
| 50 | + // ── Documentation — Getting Started ─────────────────────────────────── |
| 51 | + entry('/documentation/quick-start', 0.85, 'weekly', D.week), |
| 52 | + entry('/documentation/installation', 0.85, 'weekly', D.week), |
| 53 | + entry('/documentation/pwa', 0.82, 'weekly', D.week), |
47 | 54 |
|
48 | | - // ── Features ──────────────────────────────────────────────────────────── |
49 | | - url('/documentation/chat', 0.80, 'weekly'), |
50 | | - url('/documentation/ai-models', 0.80, 'weekly'), |
51 | | - url('/documentation/commands', 0.78, 'weekly'), |
52 | | - url('/documentation/image-generation', 0.78, 'weekly'), |
53 | | - url('/documentation/math-solver', 0.75, 'weekly'), |
54 | | - url('/documentation/pdf-analysis', 0.75, 'weekly'), |
55 | | - url('/documentation/web-search', 0.75, 'weekly'), |
56 | | - url('/documentation/smart-routing', 0.75, 'weekly'), |
57 | | - url('/documentation/jarvis-mode', 0.72, 'weekly'), |
58 | | - url('/documentation/smart-notes', 0.70, 'weekly'), |
59 | | - url('/documentation/code-analysis', 0.70, 'weekly'), |
| 55 | + // ── Documentation — Features ────────────────────────────────────────── |
| 56 | + entry('/documentation/chat', 0.80, 'weekly', D.week), |
| 57 | + entry('/documentation/ai-models', 0.80, 'weekly', D.week), |
| 58 | + entry('/documentation/commands', 0.78, 'weekly', D.week), |
| 59 | + entry('/documentation/image-generation', 0.78, 'weekly', D.week), |
| 60 | + entry('/documentation/web-search', 0.76, 'weekly', D.week), |
| 61 | + entry('/documentation/math-solver', 0.75, 'weekly', D.week), |
| 62 | + entry('/documentation/pdf-analysis', 0.75, 'weekly', D.week), |
| 63 | + entry('/documentation/smart-routing', 0.73, 'weekly', D.week), |
| 64 | + entry('/documentation/jarvis-mode', 0.70, 'monthly', D.month), |
| 65 | + entry('/documentation/smart-notes', 0.70, 'monthly', D.month), |
| 66 | + entry('/documentation/code-analysis', 0.70, 'monthly', D.month), |
60 | 67 |
|
61 | | - // ── Configuration ─────────────────────────────────────────────────────── |
62 | | - url('/documentation/settings', 0.72, 'weekly'), |
63 | | - url('/documentation/personalization', 0.70, 'weekly'), |
64 | | - url('/documentation/security', 0.68, 'monthly'), |
| 68 | + // ── Documentation — Configuration ───────────────────────────────────── |
| 69 | + entry('/documentation/settings', 0.72, 'weekly', D.week), |
| 70 | + entry('/documentation/personalization', 0.70, 'monthly', D.month), |
| 71 | + entry('/documentation/security', 0.68, 'monthly', D.month), |
65 | 72 |
|
66 | | - // ── Reference ─────────────────────────────────────────────────────────── |
67 | | - url('/documentation/api-reference', 0.75, 'weekly'), |
68 | | - url('/documentation/api', 0.70, 'weekly'), |
69 | | - url('/documentation/faq', 0.72, 'weekly'), |
| 73 | + // ── Documentation — Reference ───────────────────────────────────────── |
| 74 | + entry('/documentation/api-reference', 0.75, 'weekly', D.week), |
| 75 | + entry('/documentation/api', 0.72, 'weekly', D.week), |
| 76 | + entry('/documentation/faq', 0.75, 'weekly', D.week), |
70 | 77 | ]; |
71 | 78 | } |
0 commit comments