Skip to content

Commit 30266dc

Browse files
authored
Site fixes: serve at domain root, SEO baseline, docs mobile UX, and cleanup (#120)
1 parent 05d2759 commit 30266dc

29 files changed

Lines changed: 425 additions & 68 deletions

‎app/ai/page.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const metadata = getMetadata({
88
title: "DocumentDB for AI - Vector Search, RAG, and Embeddings",
99
description:
1010
"Build AI applications with DocumentDB: a Mongo API-compatible document model, native vector search, PostgreSQL reliability, and self-hosted deployment.",
11+
path: "/ai/",
1112
extraKeywords: [
1213
"AI database",
1314
"vector search",

‎app/components/Grid.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function Grid({ items }: {
1616
<h4 className="text-blue-300 font-mono font-medium group-hover:text-blue-200">
1717
{page.name}
1818
</h4>
19-
<p className="text-xs text-gray-400 font-italic">
19+
<p className="text-xs text-gray-400 italic">
2020
{page.description}
2121
</p>
2222
</div>

‎app/components/Markdown.tsx‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,21 @@ function getMarkdownComponents() {
244244
);
245245
},
246246

247-
// Links
248-
a: ({ children, href, ...props }: any) => (
249-
<a
250-
href={href}
251-
className="text-blue-400 hover:text-blue-300 transition-colors"
252-
target="_blank"
253-
rel="noopener noreferrer"
254-
{...props}
255-
>
256-
{children}
257-
</a>
258-
),
247+
// Links: only external links open in a new tab; internal links (/docs/...,
248+
// /samples, #anchors) navigate in place
249+
a: ({ children, href, ...props }: any) => {
250+
const isExternal = /^https?:\/\//i.test(href ?? '');
251+
return (
252+
<a
253+
href={href}
254+
className="text-blue-400 hover:text-blue-300 transition-colors"
255+
{...(isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {})}
256+
{...props}
257+
>
258+
{children}
259+
</a>
260+
);
261+
},
259262

260263
// Strong text
261264
strong: ({ children, ...props }: any) => (

‎app/components/Navbar.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { useState } from "react";
44
import Image from "next/image";
55
import Link from "next/link";
6+
import { documentdbDiscordUrl } from "../services/externalLinks";
67
import { withBasePath } from "../services/sitePath";
78

89
type NavItem = {
@@ -24,7 +25,7 @@ const navItems: NavItem[] = [
2425
},
2526
{
2627
label: "Discord",
27-
href: "https://discord.gg/vH7bYu524D",
28+
href: documentdbDiscordUrl,
2829
kind: "anchor",
2930
newTab: true,
3031
icon: "discord",

‎app/docs/[section]/[[...slug]]/page.tsx‎

Lines changed: 60 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Link from "next/link";
22
import { notFound, redirect } from 'next/navigation';
33
import { capitalCase } from 'change-case';
44
import { getAllArticlePaths, getArticleByPath } from "../../../services/articleService";
5+
import { getMetadata } from "../../../services/metadataService";
56
import ComingSoon from "../../../components/ComingSoon";
67
import CommandSnippet from "../../../components/CommandSnippet";
78
import Markdown from "../../../components/Markdown";
@@ -48,10 +49,12 @@ export async function generateMetadata({ params }: PageProps) {
4849
const selectedNavItem = navigation.find((item) => item.link.includes(file));
4950
const pageTitle = frontmatter.title || selectedNavItem?.title || section;
5051

51-
return {
52+
return getMetadata({
5253
title: `${pageTitle} - DocumentDB Documentation`,
53-
description: frontmatter.description || undefined,
54-
};
54+
description: frontmatter.description || '',
55+
path: slug.length > 0 ? `/docs/${section}/${slug.join('/')}/` : `/docs/${section}/`,
56+
type: 'article',
57+
});
5558
}
5659

5760
export default async function ArticlePage({ params }: PageProps) {
@@ -80,6 +83,34 @@ export default async function ArticlePage({ params }: PageProps) {
8083
// Use title from frontmatter if available, otherwise fall back to navigation title or section name
8184
const pageTitle = frontmatter.title || selectedNavItem?.title || section;
8285
const showInstallPrimer = section === "getting-started" && file === "index";
86+
const sectionTitle = capitalCase(section)
87+
.replace(/documentdb/i, 'DocumentDB')
88+
.replace(/api/i, 'API');
89+
90+
// Rendered once, shown in the desktop sidebar and the mobile disclosure
91+
const navigationLinks = navigation.map((item) => {
92+
// Better matching logic for active state
93+
// For index files, match both /section and /section/index
94+
// For other files, match the specific file name
95+
const itemPath = item.link.replace('/docs/', '');
96+
const currentPath = file === 'index' ? section : `${section}/${file}`;
97+
const isActive = itemPath === currentPath ||
98+
(file === 'index' && itemPath === `${section}/index`) ||
99+
(item.link.includes(file) && file !== 'index');
100+
101+
return (
102+
<Link
103+
key={item.link}
104+
href={item.link}
105+
className={`block w-full text-left px-4 py-3 rounded-lg text-sm transition-all duration-200 ${isActive
106+
? "bg-blue-500/20 text-blue-300 border border-blue-500/30"
107+
: "text-gray-300 hover:text-white hover:bg-neutral-700/50"
108+
}`}
109+
>
110+
{item.title}
111+
</Link>
112+
);
113+
});
83114

84115
return (
85116
<div className="min-h-screen bg-neutral-900 relative overflow-hidden">
@@ -94,8 +125,8 @@ export default async function ArticlePage({ params }: PageProps) {
94125
</div>
95126

96127
<div className="relative flex min-h-screen">
97-
{/* Left Sidebar */}
98-
<div className="w-80 bg-neutral-800/50 backdrop-blur-sm border-r border-neutral-700/50 flex flex-col">
128+
{/* Left Sidebar (desktop only; mobile gets the disclosure below) */}
129+
<div className="hidden w-80 bg-neutral-800/50 backdrop-blur-sm border-r border-neutral-700/50 md:flex flex-col">
99130
{/* Header */}
100131
<div className="p-6 border-b border-neutral-700/50">
101132
<Link
@@ -117,48 +148,41 @@ export default async function ArticlePage({ params }: PageProps) {
117148
</svg>
118149
Back to Documentation
119150
</Link>
120-
<h1 className="text-2xl font-bold text-white">
121-
{
122-
capitalCase(section)
123-
.replace(/documentdb/i, 'DocumentDB')
124-
.replace(/api/i, 'API')
125-
}
126-
</h1>
151+
{/* Not a heading: the article's h1 comes from the markdown content */}
152+
<p className="text-2xl font-bold text-white">
153+
{sectionTitle}
154+
</p>
127155
</div>
128156

129157
{/* Menu Items */}
130158
<div className="flex-1 p-4 overflow-y-auto">
131159
<nav className="space-y-1">
132-
{navigation.map((item) => {
133-
// Better matching logic for active state
134-
// For index files, match both /section and /section/index
135-
// For other files, match the specific file name
136-
const itemPath = item.link.replace('/docs/', '');
137-
const currentPath = file === 'index' ? section : `${section}/${file}`;
138-
const isActive = itemPath === currentPath ||
139-
(file === 'index' && itemPath === `${section}/index`) ||
140-
(item.link.includes(file) && file !== 'index');
141-
142-
return (
143-
<Link
144-
key={item.link}
145-
href={item.link}
146-
className={`block w-full text-left px-4 py-3 rounded-lg text-sm transition-all duration-200 ${isActive
147-
? "bg-blue-500/20 text-blue-300 border border-blue-500/30"
148-
: "text-gray-300 hover:text-white hover:bg-neutral-700/50"
149-
}`}
150-
>
151-
{item.title}
152-
</Link>
153-
);
154-
})}
160+
{navigationLinks}
155161
</nav>
156162
</div>
157163
</div>
158164

159165
{/* Main Content */}
160-
<div className="flex-1 p-8 overflow-y-auto">
166+
<div className="flex-1 p-4 sm:p-8 overflow-y-auto">
161167
<div className="max-w-4xl">
168+
{/* Mobile section navigation */}
169+
<details className="mb-6 rounded-lg border border-neutral-700/50 bg-neutral-800/50 md:hidden">
170+
<summary className="cursor-pointer px-4 py-3 text-sm font-semibold text-gray-200">
171+
{sectionTitle} navigation
172+
</summary>
173+
<div className="border-t border-neutral-700/50 p-3">
174+
<Link
175+
href="/docs"
176+
className="block px-4 py-2 text-sm text-blue-400 hover:text-blue-300 transition-colors"
177+
>
178+
← Back to Documentation
179+
</Link>
180+
<nav className="space-y-1">
181+
{navigationLinks}
182+
</nav>
183+
</div>
184+
</details>
185+
162186
{/* Coming Soon Component for coming-soon layout */}
163187
{frontmatter.layout === 'coming-soon' && <ComingSoon />}
164188

‎app/docs/page.tsx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
import Link from "next/link";
22
import { getArticleContent } from "../services/articleService";
3+
import { getMetadata } from "../services/metadataService";
4+
5+
export function generateMetadata() {
6+
const articleContent = getArticleContent();
7+
return getMetadata({
8+
title: `${articleContent.landing.title} - DocumentDB`,
9+
description: articleContent.landing.description,
10+
path: '/docs/',
11+
});
12+
}
313

414
export default function Docs() {
515
const articleContent = getArticleContent();

‎app/docs/reference/[type]/[category]/[name]/page.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export async function generateMetadata({ params }: { params: Promise<{ type: str
2020
return getMetadata({
2121
title: `${data.frontmatter.title || name} - DocumentDB MQL Reference`,
2222
description: data.frontmatter.description || '',
23+
path: `/docs/reference/${type}/${category}/${name}/`,
24+
type: 'article',
2325
extraKeywords: ['reference', type, category, name]
2426
});
2527
}

‎app/docs/reference/[type]/[category]/page.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ export async function generateMetadata({ params }: { params: Promise<{ type: str
1717
const title = `${capitalCase(category)} ${capitalCase(pluralize(type))}`;
1818
const description = getCategoryDescription(type, category);
1919
return getMetadata({
20-
title: `${title} - DocumentDB MQL Reference`,
20+
title: `${title} - DocumentDB MQL Reference`,
2121
description: await sanitizeMarkdown(description),
22+
path: `/docs/reference/${type}/${category}/`,
2223
extraKeywords: ['reference', type, category]
2324
});
2425
}
@@ -38,9 +39,9 @@ export default async function CommandReferencePage({ params }: { params: Promise
3839
<article>
3940
<Breadcrumb type={type} category={category} />
4041
<div className="mb-8">
41-
<h2 className="text-4xl font-bold text-white mb-4 capitalize">
42+
<h1 className="text-4xl font-bold text-white mb-4 capitalize">
4243
MongoDB Query Language (MQL) {capitalCase(category)} {capitalCase(pluralize(type))}
43-
</h2>
44+
</h1>
4445
<div className="w-24 h-1 bg-gradient-to-r from-blue-500 via-purple-500 to-green-500 rounded-full mb-6"></div>
4546
{description && (
4647
<div className="text-gray-400 text-lg mb-6">

‎app/docs/reference/[type]/page.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ export async function generateMetadata({ params }: { params: Promise<{ type: str
2020
const title = capitalCase(pluralize(type));
2121
const description = getTypeDescription(type);
2222
return getMetadata({
23-
title: `${title} - DocumentDB MQL Reference`,
23+
title: `${title} - DocumentDB MQL Reference`,
2424
description: await sanitizeMarkdown(description),
25+
path: `/docs/reference/${type}/`,
2526
extraKeywords: ['reference', type]
2627
});
2728
}
@@ -37,9 +38,9 @@ export default async function CommandReferencePage({ params }: { params: Promise
3738
<article>
3839
<Breadcrumb type={type} />
3940
<div className="mb-8">
40-
<h2 className="text-4xl font-bold text-white mb-4 capitalize">
41+
<h1 className="text-4xl font-bold text-white mb-4 capitalize">
4142
MongoDB Query Language (MQL) {capitalCase(pluralize(type))}
42-
</h2>
43+
</h1>
4344
<div className="w-24 h-1 bg-gradient-to-r from-blue-500 via-purple-500 to-green-500 rounded-full mb-6"></div>
4445
{description && (
4546
<div className="text-gray-400 text-lg mb-6">

‎app/docs/reference/layout.tsx‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export default function ReferenceLayout({
2929
></div>
3030
</div>
3131
<div className="relative flex h-screen">
32-
<div className="w-80 bg-neutral-800/50 backdrop-blur-sm border-r border-neutral-700/50 flex flex-col h-full">
32+
{/* Sidebar (desktop only; mobile gets the disclosure below) */}
33+
<div className="hidden w-80 bg-neutral-800/50 backdrop-blur-sm border-r border-neutral-700/50 md:flex flex-col h-full">
3334
<div className="p-6 border-b border-neutral-700/50 flex-shrink-0">
3435
<Link href="/docs" className="text-blue-400 hover:text-blue-300 text-sm mb-4 flex items-center transition-colors">
3536
<svg
@@ -51,8 +52,17 @@ export default function ReferenceLayout({
5152
</div>
5253
<Index groupedReferences={groupedReferences} />
5354
</div>
54-
<article className="flex-1 p-8 overflow-y-auto h-full">
55+
<article className="flex-1 p-4 sm:p-8 overflow-y-auto h-full">
5556
<div className="max-w-4xl">
57+
{/* Mobile reference navigation */}
58+
<details className="mb-6 rounded-lg border border-neutral-700/50 bg-neutral-800/50 md:hidden">
59+
<summary className="cursor-pointer px-4 py-3 text-sm font-semibold text-gray-200">
60+
MQL reference navigation
61+
</summary>
62+
<div className="max-h-[60vh] overflow-y-auto border-t border-neutral-700/50">
63+
<Index groupedReferences={groupedReferences} />
64+
</div>
65+
</details>
5666
{children}
5767
</div>
5868
</article>

0 commit comments

Comments
 (0)