diff --git a/src/app/sitemap.js b/src/app/sitemap.js index b162a93a..525b9b40 100644 --- a/src/app/sitemap.js +++ b/src/app/sitemap.js @@ -6,6 +6,10 @@ const baseDir = 'src/app'; const dynamicDirs = ['blog', 'videos', 'newsletter', 'demos', 'vectordatabases', 'devtools', 'comparisons']; const excludeDirs = ['api', 'rss']; const excludeFiles = ['[name]']; +const dynamicDetailDirs = [ + { base: 'devtools', detail: 'detail', jsonFile: 'ai-assisted-developer-tools.json', key: 'tools' }, + { base: 'vectordatabases', detail: 'detail', jsonFile: 'vectordatabases.json', key: 'databases' } +]; function getRoutes() { const fullPath = path.join(process.cwd(), baseDir); @@ -44,6 +48,21 @@ function getRoutes() { } }); + + // Manually add dynamic routes for /devtools/detail and /vectordatabases/detail + dynamicDetailDirs.forEach(({ base, detail, jsonFile, key }) => { + const jsonFilePath = path.join(process.cwd(), 'schema/data', jsonFile); + if (fs.existsSync(jsonFilePath)) { + const jsonData = JSON.parse(fs.readFileSync(jsonFilePath, 'utf-8')); + const detailNames = jsonData[key].map(item => item.name); + + detailNames.forEach(name => { + const encodedName = encodeURIComponent(name); + routes.add(`/${base}/${detail}/${encodedName}`); + }); + } + }); + // Add RSS feed routes routes.add('/rss/feed.json'); routes.add('/rss/feed.xml'); diff --git a/src/components/SimpleNav.jsx b/src/components/SimpleNav.jsx index d88e360f..b174ddc2 100644 --- a/src/components/SimpleNav.jsx +++ b/src/components/SimpleNav.jsx @@ -10,6 +10,8 @@ const navItems = [ { label: 'Research', href: '/blog' }, { label: 'Projects', href: '/projects' }, { label: 'Publications', href: '/publications' }, + { label: 'Compare AI Devtools', href: '/devtools' }, + { label: 'Compare vector databases', href: '/vectordatabases' }, { label: 'Demos', href: '/demos' }, { label: 'Videos', href: '/videos' }, { label: 'About', href: '/about' },