forked from langfuse/langfuse-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext-sitemap.config.js
More file actions
50 lines (47 loc) · 1.86 KB
/
next-sitemap.config.js
File metadata and controls
50 lines (47 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Generated by scripts/generate-sitemap-excludes.js (runs during prebuild).
// Contains paths with noindex:true or a canonical pointing to a different URL.
let sitemapExcludes = [];
try {
sitemapExcludes = require("./.sitemap-excludes.json");
} catch {
// File not yet generated (e.g. first run without prebuild). Silently ignore.
}
// All valid content page paths — used for additionalPaths so that
// server-rendered pages (blog, changelog, faq, handbook, etc.) that are NOT
// statically pre-built are still included in the sitemap.
let allPages = [];
try {
allPages = require("./.sitemap-all-pages.json");
} catch {
// File not yet generated. Silently ignore.
}
const BASE_URL = process.env.CF_PAGES_URL ?? 'https://langfuse.com';
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: BASE_URL,
generateRobotsTxt: true,
changefreq: 'daily',
// Provide every content page explicitly so server-rendered pages
// (not statically built) are included. next-sitemap deduplicates,
// so static pages appearing in both discovery and here is fine.
additionalPaths: async () => {
const entries = [
// Root
{ loc: '/', priority: 1, changefreq: 'daily', lastmod: new Date().toISOString() },
];
for (const route of allPages) {
entries.push({ loc: route, changefreq: 'daily', lastmod: new Date().toISOString() });
}
return entries;
},
exclude: [
// Exclude _meta files and non-content routes
'*/_meta',
'/events/*',
// Pages with noindex:true or a canonical override (generated by prebuild script).
// Cookbook duplicate routes are already omitted from allPages.
...sitemapExcludes,
// Exclude API routes for static export
...(process.env.STATIC_EXPORT === 'true' ? ['/api/*'] : [])
],
}