Skip to content

Commit

Permalink
Merge pull request #582 from zackproser/expand-nav
Browse files Browse the repository at this point in the history
Add devtools and vectordatabases to nav
  • Loading branch information
zackproser authored Aug 29, 2024
2 parents cdd4630 + aa85169 commit 5488638
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/app/sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 2 additions & 0 deletions src/components/SimpleNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down

0 comments on commit 5488638

Please sign in to comment.