diff --git a/app/ai/page.tsx b/app/ai/page.tsx
index de034af..39d06a4 100644
--- a/app/ai/page.tsx
+++ b/app/ai/page.tsx
@@ -1,15 +1,10 @@
-import Image from "next/image";
+import type { ReactNode } from "react";
import Link from "next/link";
import CommandSnippet from "../components/CommandSnippet";
+import { SampleCard } from "../components/SampleCard";
import TelemetryNote from "../components/TelemetryNote";
+import { samples } from "../data/samples";
import { getMetadata } from "../services/metadataService";
-import {
- documentdbGitHubForks,
- documentdbGitHubStars,
- documentdbTscMembers,
- documentdbTscOrganizations,
-} from "../services/projectStats";
-import { withBasePath } from "../services/sitePath";
export const metadata = getMetadata({
title: "DocumentDB for AI - Vector Search, RAG, and Embeddings",
@@ -27,47 +22,61 @@ export const metadata = getMetadata({
],
});
+const agentKitUrl = "https://github.com/Azure/documentdb-agent-kit";
+const vectorSearchReference = "/docs/reference/operators/aggregation/$vectorsearch/";
+
const quickRunCommand = `docker run -dt --pull always --name documentdb \\
-p 127.0.0.1:10260:10260 \\
-e USERNAME=admin \\
-e PASSWORD=password \\
ghcr.io/documentdb/documentdb/documentdb-local:latest`;
-const connectCommand = `mongosh "mongodb://admin:password@localhost:10260/?tls=true&tlsAllowInvalidCertificates=true"`;
+const modelCommand = `ollama pull nomic-embed-text
+pip install pymongo ollama`;
-const createIndexCommand = `// Real embeddings are longer: set dimensions to your model's size, such as 1536.
-db.documents.insertMany([
- { title: "Vector indexes", category: "technical", embedding: [0.10, -0.02, 0.30] },
- { title: "Release notes", category: "news", embedding: [0.90, 0.40, -0.10] }
-]);
+const storeCode = `import ollama
+from pymongo import MongoClient
-db.runCommand({
- createIndexes: "documents",
- indexes: [{
- key: { embedding: "cosmosSearch" },
- name: "vector_idx",
- cosmosSearchOptions: {
- kind: "vector-hnsw",
- similarity: "COS",
- dimensions: 3
- }
- }]
-});
+client = MongoClient("mongodb://admin:password@localhost:10260/?tls=true&tlsAllowInvalidCertificates=true")
+db = client.demo
-// $vectorSearch filters need an index on each filtered field.
-db.documents.createIndex({ category: 1 });`;
+def embed(text):
+ return ollama.embed(model="nomic-embed-text", input=text)["embeddings"][0]
-const vectorSearchCommand = `db.documents.aggregate([
- {
- $vectorSearch: {
- queryVector: [0.12, -0.04, 0.31],
- path: "embedding",
- limit: 10,
- numCandidates: 100,
- filter: { category: "technical" }
- }
- }
-]);`;
+notes = [
+ "DocumentDB is an open-source document database built on PostgreSQL.",
+ "Our office is closed on public holidays.",
+ "Keep each text chunk next to its embedding so retrieval returns the source.",
+]
+db.notes.insert_many([{"text": t, "embedding": embed(t)} for t in notes])
+
+db.command({
+ "createIndexes": "notes",
+ "indexes": [{
+ "key": {"embedding": "cosmosSearch"},
+ "name": "vector_idx",
+ "cosmosSearchOptions": {
+ "kind": "vector-hnsw",
+ "similarity": "COS",
+ "dimensions": 768, # nomic-embed-text output size
+ },
+ }],
+})`;
+
+const searchCode = `question = "Which database runs on Postgres?"
+results = db.notes.aggregate([
+ {"$vectorSearch": {"queryVector": embed(question), "path": "embedding", "limit": 2}},
+ {"$project": {"_id": 0, "text": 1, "score": {"$meta": "searchScore"}}},
+])
+for note in results:
+ print(f"{note['score']:.2f} {note['text']}")`;
+
+const documentExample = `{
+ _id: "handbook-chunk-42",
+ text: "Keep each chunk next to its embedding...",
+ source: "handbook.pdf",
+ embedding: [0.0213, -0.0871, 0.0456, /* ...768 numbers */]
+}`;
const heroBadges = [
"Start locally in minutes",
@@ -106,35 +115,37 @@ const beforeAfter = [
const quickStartSteps = [
{
step: "01",
- title: "Run locally with Docker",
- description:
- "One command to start DocumentDB on port 10260 with local credentials.",
+ title: "Run DocumentDB",
+ description: "One command starts DocumentDB on port 10260 with local credentials.",
label: "Docker",
code: quickRunCommand,
},
{
step: "02",
- title: "Connect with mongosh",
+ title: "Get an embedding model",
description:
- "Connect with mongosh, pymongo, the Node.js driver, or another standard Mongo client.",
+ "Ollama runs an open embedding model on your machine, so your text never leaves it. Any model works; size the index to its output.",
label: "Shell",
- code: connectCommand,
+ code: modelCommand,
+ link: { label: "Download Ollama", href: "https://ollama.com/download" },
},
{
step: "03",
- title: "Create a vector index",
+ title: "Store text with its embedding",
description:
- "Add sample documents, a native HNSW vector index with cosine similarity, and an index on the field you filter by.",
- label: "Index",
- code: createIndexCommand,
+ "Embed each note, store it next to its text, and add an HNSW vector index with cosine similarity.",
+ label: "Python: store",
+ code: storeCode,
+ link: { label: "createIndexes reference", href: "/docs/reference/commands/indexing/createIndexes/" },
},
{
step: "04",
- title: "Query by meaning",
+ title: "Ask a question",
description:
- "Retrieve semantically similar results with vector search and optional metadata filters.",
- label: "Vector search",
- code: vectorSearchCommand,
+ "Add this to the same script. It embeds the question and returns the closest notes with their similarity scores.",
+ label: "Python: search",
+ code: searchCode,
+ link: { label: "$vectorSearch reference", href: vectorSearchReference },
},
];
@@ -148,6 +159,7 @@ const useCases = [
"Pre-filter by category, source, or recency before retrieval",
"Return source text alongside similarity scores",
],
+ sampleId: "hotel-agent-ts",
},
{
badge: "Search",
@@ -158,6 +170,7 @@ const useCases = [
"Choose cosine, L2, or inner product for your domain",
"Mix vector results with metadata filters in one query",
],
+ sampleId: "content-semantic-search-py",
},
{
badge: "Agents",
@@ -168,57 +181,48 @@ const useCases = [
"Persist tool outputs, plans, and dialogue turns naturally",
"Recall relevant history without scanning entire threads",
],
+ sampleId: "personal-memory-mcp-ts",
},
{
badge: "Graph + AI",
title: "Knowledge navigation",
description:
- "Find the best vector matches, then traverse related entities with `$graphLookup` in one query pipeline.",
+ "Find the best vector matches, then traverse related entities with $graphLookup in one query pipeline.",
points: [
"Recursive traversal with depth control",
"Useful when retrieval also needs relationship traversal",
],
+ reference: { label: "$graphLookup reference", href: "/docs/reference/operators/aggregation/$graphlookup/" },
},
];
-const credibilityPoints = [
- {
- value: documentdbGitHubStars,
- label: "GitHub stars",
- },
- {
- value: documentdbGitHubForks,
- label: "Forks",
- },
- {
- value: documentdbTscMembers,
- label: "TSC members",
- detail: `across ${documentdbTscOrganizations} organizations`,
- },
-];
+// The gallery is compiled from its registry at build time, so new vector search samples show up here on their own
+const aiSamples = samples.filter((sample) => sample.tags.includes("Vector Search"));
+const aiFrameworks = ["LlamaIndex", "Ollama", "OpenAI", "MCP"].filter((tag) =>
+ aiSamples.some((sample) => sample.tags.includes(tag)),
+);
-const contributorLogos = [
- {
- name: "Microsoft",
- src: "/images/AzureLogo.png",
- },
- {
- name: "Amazon",
- src: "/images/AWS%20Logo.png",
- },
- {
- name: "Rippling",
- src: "/images/Rippling%20Logo%20no%20background.png",
- },
- {
- name: "YugabyteDB",
- src: "/images/YugabyteLogo.png",
- },
- {
- name: "AB InBev",
- src: "/images/AB%20InBev%20transparent%20logo.png",
- },
-];
+function useCaseLink(useCase: (typeof useCases)[number]) {
+ if (useCase.reference) return useCase.reference;
+ const sample = samples.find((candidate) => candidate.id === useCase.sampleId);
+ return sample ? { label: `Sample: ${sample.title.split(":")[0]}`, href: sample.githubUrl } : null;
+}
+
+// Site paths go through Link so preview deployments keep their base path
+function TextLink({ href, className, children }: { href: string; className: string; children: ReactNode }) {
+ if (href.startsWith("/")) {
+ return (
+
+ {children}
+
+ );
+ }
+ return (
+
+ {children}
+
+ );
+}
function SectionIntro({
eyebrow,
@@ -242,6 +246,8 @@ function SectionIntro({
);
}
+const textLinkClass = "font-semibold text-violet-300 transition-colors hover:text-violet-200";
+
export default function AIPage() {
return (
@@ -263,18 +269,18 @@ export default function AIPage() {
keep documents plus embeddings together — no extra sync layer needed.
{heroBadges.map((badge) => (
@@ -291,24 +297,24 @@ export default function AIPage() {
- Quick start
+ One document
- Vector search in minutes
+ No second database
- Start locally with one Docker command
+ Your text, its metadata, and its embedding live together
-
- Spin up DocumentDB with Docker, then follow the four-step quick
- start below to connect with mongosh, create a vector index, and
- run your first vector search.
-
-
-
-
+
+
+ A single $vectorSearch stage finds the
+ nearest embeddings and returns the documents they belong to.
+
@@ -373,12 +379,15 @@ export default function AIPage() {
-
+
{quickStartSteps.map((item) => (
@@ -400,14 +409,16 @@ export default function AIPage() {
{item.code === quickRunCommand && }
+ {item.link ? (
+
+ {item.link.label} →
+
+ ) : null}
))}
-
+
Follow the full Docker quick start
- {useCases.map((item) => (
-
-
- {item.badge}
-
- {item.title}
- {item.description}
-
- {item.points.map((point) => (
-
-
- {point}
-
- ))}
-
-
- ))}
+ {useCases.map((item) => {
+ const link = useCaseLink(item);
+ return (
+
+
+ {item.badge}
+
+ {item.title}
+ {item.description}
+
+ {item.points.map((point) => (
+
+
+ {point}
+
+ ))}
+
+ {link ? (
+
+ {link.label} →
+
+ ) : null}
+
+ );
+ })}
-
+
-
- {credibilityPoints.map((item) => (
-
- {item.value}
-
- {item.label}
-
- {"detail" in item && item.detail && (
- {item.detail}
- )}
-
+ {aiFrameworks.length > 0 ? (
+
+ Built with
+ {aiFrameworks.map((framework) => (
+
+ {framework}
+
+ ))}
+
+ ) : null}
+
+ {aiSamples.map((sample) => (
+
))}
-
- {contributorLogos.map((logo) => (
-
-
+
+ Browse all samples →
+
+
+
+
+
+
+
+
+
+
+ For coding agents
+
+
+ Public preview
+
- ))}
+
+ Teach your coding agent DocumentDB
+
+
+ Agent-Kit gives Claude Code, Cursor, Codex, Gemini CLI, and GitHub Copilot skills
+ for data modeling, indexing, and vector search, an MCP server, and read-only
+ diagnostics for a local DocumentDB container.
+
+
+
+ Get Agent-Kit on GitHub
+
@@ -501,7 +541,7 @@ export default function AIPage() {
Ready to try it?
- Go from zero to vector search in four commands. Open source, self-hosted, MIT-licensed.
+ Go from zero to vector search in four steps. Open source, self-hosted, MIT-licensed.
}) {
+type NavLink = { label: string; href: string; section?: string };
+type NavGroup = { label: string; items: NavLink[] };
+type NavIconLink = NavLink & { icon: string };
+
+const links: (NavLink | NavGroup)[] = nav.links;
+const iconLinks: NavIconLink[] = nav.icons;
+
+const desktopLinkClass =
+ "flex items-center gap-1 font-medium text-gray-300 transition-colors duration-200 hover:text-blue-400 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-blue-400";
+const dropdownLinkClass =
+ "flex items-center justify-between gap-3 rounded-md px-3 py-2 text-sm font-medium text-gray-300 transition-colors duration-200 hover:bg-neutral-800 hover:text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400";
+const mobileLinkClass =
+ "flex items-center gap-3 rounded-md px-3 py-2.5 text-sm font-medium text-gray-300 transition-colors duration-200 hover:bg-neutral-800 hover:text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400";
+
+function isExternal(href: string) {
+ return /^https?:\/\//.test(href);
+}
+
+function groupId(label: string) {
+ return `nav-${label.toLowerCase()}`;
+}
+
+function NavAnchor({
+ link,
+ className,
+ onClick,
+ children,
+}: {
+ link: NavLink;
+ className: string;
+ onClick?: () => void;
+ children: ReactNode;
+}) {
+ if (isExternal(link.href)) {
+ return (
+
+ {children}
+
+ );
+ }
+
+ // Jekyll builds these sections, so they are not Next.js routes
+ if (link.section) {
+ return (
+
+ {children}
+
+ );
+ }
+
+ return (
+
+ {children}
+
+ );
+}
+
+function BrandIcon({ name }: { name: string }) {
if (name === "github") {
return (
-
+
}) {
);
}
- return (
-
-
-
- );
-}
-
-function renderNavItem(
- item: NavItem,
- className: string,
- onClick?: () => void,
-) {
- const content = (
- <>
- {item.icon ? : null}
- {item.label}
- >
- );
-
- if (item.kind === "link") {
+ if (name === "discord") {
return (
-
- {content}
-
+
+
+
);
}
+ return null;
+}
+
+function ExternalIcon() {
return (
-
- {content}
-
+
+
+
);
}
export default function Navbar() {
const [isMenuOpen, setIsMenuOpen] = useState(false);
+ const [openGroup, setOpenGroup] = useState(null);
+ const desktopNav = useRef(null);
const closeMenu = () => setIsMenuOpen(false);
+ const closeGroup = () => setOpenGroup(null);
+
+ useEffect(() => {
+ if (!openGroup) return;
+ // Safari never focuses a clicked button, so blur alone cannot close the panel
+ const closeOnOutsidePointer = (event: PointerEvent) => {
+ if (!desktopNav.current?.contains(event.target as Node)) setOpenGroup(null);
+ };
+ const closeOnEscape = (event: KeyboardEvent) => {
+ if (event.key !== "Escape") return;
+ setOpenGroup(null);
+ document.getElementById(`${groupId(openGroup)}-button`)?.focus();
+ };
+ document.addEventListener("pointerdown", closeOnOutsidePointer);
+ document.addEventListener("keydown", closeOnEscape);
+ return () => {
+ document.removeEventListener("pointerdown", closeOnOutsidePointer);
+ document.removeEventListener("keydown", closeOnEscape);
+ };
+ }, [openGroup]);
return (
@@ -120,18 +139,84 @@ export default function Navbar() {
DocumentDB
-
- {navItems.map((item) =>
- renderNavItem(
- item,
- "flex items-center gap-2 text-gray-300 transition-colors duration-200 font-medium hover:text-blue-400 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-blue-400",
- ),
- )}
+
+ {links.map((item) => {
+ if (!("items" in item)) {
+ return (
+
+ {item.label}
+
+ );
+ }
+
+ const id = groupId(item.label);
+ const isOpen = openGroup === item.label;
+ return (
+
{
+ if (!event.currentTarget.contains(event.relatedTarget)) {
+ setOpenGroup((current) => (current === item.label ? null : current));
+ }
+ }}
+ >
+
setOpenGroup(isOpen ? null : item.label)}
+ className={`${desktopLinkClass} cursor-pointer`}
+ >
+ {item.label}
+
+
+
+
+ {/* Rendered while closed so crawlers still see the links */}
+
+ {item.items.map((link) => (
+
+ {link.label}
+ {isExternal(link.href) ? : null}
+
+ ))}
+
+
+ );
+ })}
+
+
+ {iconLinks.map((link) => (
+
+
+ {link.label}
+
+ ))}
+
{isMenuOpen ? (
-
+
- {navItems.map((item) =>
- renderNavItem(
- item,
- "flex items-center gap-3 rounded-md px-3 py-2.5 text-sm font-medium text-gray-300 transition-colors duration-200 hover:bg-neutral-800 hover:text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400",
- closeMenu,
+ {links.map((item) =>
+ "items" in item ? (
+
+
+ {item.label}
+
+ {item.items.map((link) => (
+
+ {link.label}
+ {isExternal(link.href) ? : null}
+
+ ))}
+
+ ) : (
+
+ {item.label}
+
),
)}
+
+ {iconLinks.map((link) => (
+
+
+ {link.label}
+
+ ))}
+
) : null}
diff --git a/blogs/_config.yml b/blogs/_config.yml
index 81be542..8facee6 100644
--- a/blogs/_config.yml
+++ b/blogs/_config.yml
@@ -1,7 +1,7 @@
title: DocumentDB Blog
description: Insights, updates, and deep dives into the world of document databases and open-source innovation.
-# Shared external links. The Next.js app keeps the same values in
-# app/services/externalLinks.ts; update both when one changes.
+# Shared external links. app/services/externalLinks.ts and _data/nav.json hold
+# the same invite; tests/blogSections.test.ts fails if they differ.
discord_url: https://discord.gg/vH7bYu524D
# Shared release announcement target. app/services/externalLinks.ts holds
# the same site-root path.
diff --git a/blogs/_data/nav.json b/blogs/_data/nav.json
new file mode 100644
index 0000000..72c2d19
--- /dev/null
+++ b/blogs/_data/nav.json
@@ -0,0 +1,30 @@
+{
+ "links": [
+ { "label": "Docs", "href": "/docs" },
+ { "label": "Install & Download", "href": "/packages" },
+ { "label": "AI", "href": "/ai" },
+ { "label": "Kubernetes", "href": "/kubernetes-operator" },
+ {
+ "label": "Build",
+ "items": [
+ { "label": "Samples", "href": "/samples" },
+ {
+ "label": "VS Code extension",
+ "href": "https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-documentdb"
+ },
+ { "label": "Agent-Kit", "href": "https://github.com/Azure/documentdb-agent-kit" }
+ ]
+ },
+ {
+ "label": "News",
+ "items": [
+ { "label": "Announcements", "href": "/announcements/", "section": "announcements" },
+ { "label": "Blogs", "href": "/blogs/", "section": "blogs" }
+ ]
+ }
+ ],
+ "icons": [
+ { "label": "GitHub", "href": "https://github.com/documentdb/documentdb", "icon": "github" },
+ { "label": "Discord", "href": "https://discord.gg/vH7bYu524D", "icon": "discord" }
+ ]
+}
diff --git a/blogs/_includes/nav-icon.html b/blogs/_includes/nav-icon.html
new file mode 100644
index 0000000..4562571
--- /dev/null
+++ b/blogs/_includes/nav-icon.html
@@ -0,0 +1,11 @@
+{%- comment -%}Same icons as app/components/Navbar.tsx{%- endcomment -%}
+{%- case include.name -%}
+{%- when 'github' -%}
+
+{%- when 'discord' -%}
+
+{%- when 'chevron' -%}
+
+{%- when 'external' -%}
+
+{%- endcase -%}
diff --git a/blogs/_includes/nav-link.html b/blogs/_includes/nav-link.html
new file mode 100644
index 0000000..d042af1
--- /dev/null
+++ b/blogs/_includes/nav-link.html
@@ -0,0 +1,12 @@
+{%- comment -%}One nav.json link; current_section comes from the layout{%- endcomment -%}
+{%- assign nav_link = include.link -%}
+{%- if include.icon -%}
+ {%- capture nav_label -%}{% include nav-icon.html name=nav_link.icon %}
{{ nav_link.label | escape }} {%- endcapture -%}
+{%- else -%}
+ {%- assign nav_label = nav_link.label | escape -%}
+{%- endif -%}
+{%- if nav_link.href contains '://' -%}
+
{{ nav_label }}{% unless include.icon %}{% include nav-icon.html name='external' %}{% endunless %}
+{%- else -%}
+
{{ nav_label }}
+{%- endif -%}
diff --git a/blogs/_layouts/default.html b/blogs/_layouts/default.html
index d0ce57b..c31cef5 100644
--- a/blogs/_layouts/default.html
+++ b/blogs/_layouts/default.html
@@ -41,26 +41,9 @@
{% assign home_href = '/' | relative_url %}
- {% assign docs_href = '/docs' | relative_url %}
- {% assign packages_href = '/packages' | relative_url %}
- {% assign operator_href = '/kubernetes-operator' | relative_url %}
{% assign logo_href = '/images/DocumentDB Logo - background removed.png' | relative_url %}
- {% assign blogs_href = '/blogs/' | relative_url %}
- {% assign announcements_href = '/announcements/' | relative_url %}
{% assign current_section = page.section | default: 'blogs' %}
- {% capture nav_links %}
-
Home
-
GitHub
-
Discord
-
Docs
-
Download
-
Agent-Kit
-
K8s Operator
-
Announcements
-
Blogs
- {% endcapture %}
-
{% assign release_page_href = '/v1/' | relative_url %}
@@ -76,7 +59,24 @@
{% comment %}One landmark for both layouts; screen readers otherwise lose it while the menu is closed{% endcomment %}
- {{ nav_links }}
+ {% comment %}blogs/_data/nav.json also drives app/components/Navbar.tsx{% endcomment %}
+
+ {%- for item in site.data.nav.links -%}
+ {%- if item.items -%}
+
+ {{ item.label }}{% include nav-icon.html name='chevron' %}
+
+ {%- for link in item.items %}{% include nav-link.html link=link %}{% endfor -%}
+
+
+ {%- else %}
+ {% include nav-link.html link=item %}
+ {%- endif -%}
+ {%- endfor %}
+
+ {%- for link in site.data.nav.icons %}{% include nav-link.html link=link icon=true %}{% endfor -%}
+
+
@@ -102,26 +114,34 @@
- {% comment %}The open panel covers the page, so close it whenever focus or the page moves on{% endcomment %}
+ {% comment %}Open panels cover the page, so close them whenever focus, a tap or the page moves on{% endcomment %}
diff --git a/blogs/assets/blog.css b/blogs/assets/blog.css
index 7ed2572..66e738d 100644
--- a/blogs/assets/blog.css
+++ b/blogs/assets/blog.css
@@ -134,21 +134,111 @@ a {
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
- gap: 2rem;
+ gap: 1.5rem;
font-size: 0.95rem;
font-weight: 500;
color: var(--muted);
}
-.site-nav a {
+.site-nav a,
+.site-dropdown > summary {
white-space: nowrap;
transition: color 160ms ease;
}
-.site-nav a[aria-current="page"] {
+.site-nav a[aria-current="page"],
+.site-dropdown:has([aria-current="page"]) > summary {
color: #60a5fa;
}
+.site-nav a:focus-visible,
+.site-dropdown > summary:focus-visible {
+ outline: 2px solid #60a5fa;
+ outline-offset: 4px;
+ border-radius: 0.25rem;
+}
+
+.nav-icon {
+ display: block;
+ width: 1.25rem;
+ height: 1.25rem;
+}
+
+.nav-chevron {
+ width: 1rem;
+ height: 1rem;
+ transition: transform 160ms ease;
+}
+
+.nav-external {
+ flex-shrink: 0;
+ width: 0.875rem;
+ height: 0.875rem;
+ color: var(--subtle);
+}
+
+.site-dropdown {
+ position: relative;
+}
+
+.site-dropdown > summary {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.25rem;
+ cursor: pointer;
+ list-style: none;
+}
+
+.site-dropdown > summary::-webkit-details-marker {
+ display: none;
+}
+
+.site-dropdown[open] .nav-chevron {
+ transform: rotate(180deg);
+}
+
+.site-dropdown__panel {
+ position: absolute;
+ top: calc(100% + 0.75rem);
+ left: 50%;
+ z-index: 50;
+ display: flex;
+ flex-direction: column;
+ width: 14rem;
+ padding: 0.375rem;
+ transform: translateX(-50%);
+ border: 1px solid rgba(64, 64, 64, 0.9);
+ border-radius: 0.5rem;
+ background: rgb(23, 23, 27);
+ box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6);
+}
+
+.site-dropdown__panel a {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.75rem;
+ padding: 0.5rem 0.75rem;
+ border-radius: 0.375rem;
+ font-size: 0.875rem;
+}
+
+.site-dropdown__panel a[aria-current="page"] {
+ background: rgba(38, 38, 45, 0.9);
+}
+
+.site-nav__icons {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.5rem;
+ padding-left: 1rem;
+ border-left: 1px solid rgba(64, 64, 64, 0.9);
+}
+
+.site-nav__icons a {
+ padding: 0.375rem;
+}
+
.site-menu {
display: none;
}
@@ -210,6 +300,9 @@ a {
}
.site-menu__links a {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
padding: 0.625rem 0.75rem;
border-radius: 0.375rem;
color: var(--muted);
@@ -217,6 +310,24 @@ a {
font-weight: 500;
}
+.site-menu__group {
+ margin: 0.5rem 0 0;
+ padding: 0.5rem 0.75rem 0.25rem;
+ color: var(--subtle);
+ font-size: 0.75rem;
+ font-weight: 600;
+ letter-spacing: 0.18em;
+ text-transform: uppercase;
+}
+
+.site-menu__icons {
+ display: flex;
+ gap: 0.25rem;
+ margin-top: 0.5rem;
+ padding-top: 0.75rem;
+ border-top: 1px solid rgba(64, 64, 64, 0.9);
+}
+
.site-menu__links a[aria-current="page"] {
background: rgba(38, 38, 45, 0.9);
color: #60a5fa;
@@ -224,10 +335,16 @@ a {
/* Touch screens would keep a tapped item highlighted */
@media (hover: hover) {
- .site-nav a:hover {
+ .site-nav a:hover,
+ .site-dropdown > summary:hover {
color: #60a5fa;
}
+ .site-dropdown__panel a:hover {
+ background: rgba(38, 38, 45, 0.9);
+ color: #fff;
+ }
+
.site-menu__toggle:hover {
border-color: #60a5fa;
color: #fff;
@@ -239,8 +356,8 @@ a {
}
}
-/* Same query as the main navbar's Tailwind max-xl; print keeps the plain link list */
-@media screen and (width < 80rem) {
+/* Same query as the main navbar's Tailwind max-lg; print keeps the plain link list */
+@media screen and (width < 64rem) {
.site-nav {
display: none;
}
diff --git a/tests/aiPage.test.tsx b/tests/aiPage.test.tsx
new file mode 100644
index 0000000..de2c9a6
--- /dev/null
+++ b/tests/aiPage.test.tsx
@@ -0,0 +1,22 @@
+import { createElement } from 'react';
+import { renderToStaticMarkup } from 'react-dom/server';
+import { describe, expect, it } from 'vitest';
+import AIPage from '../app/ai/page';
+import { samples } from '../app/data/samples';
+
+describe('AI page', () => {
+ const html = renderToStaticMarkup(createElement(AIPage));
+
+ it('shows every vector search sample from the gallery', () => {
+ const aiSamples = samples.filter((sample) => sample.tags.includes('Vector Search'));
+ expect(aiSamples.length).toBeGreaterThan(0);
+ for (const sample of aiSamples) {
+ expect(html).toContain(`href="${sample.githubUrl}"`);
+ }
+ });
+
+ // A sample renamed or removed in the gallery registry would otherwise drop its link silently
+ it('links the RAG, search, and agent memory use cases to their samples', () => {
+ expect(html.match(/>Sample: /g)).toHaveLength(3);
+ });
+});
diff --git a/tests/blogSections.test.ts b/tests/blogSections.test.ts
index aa163fa..a07a170 100644
--- a/tests/blogSections.test.ts
+++ b/tests/blogSections.test.ts
@@ -8,6 +8,8 @@ import matter from 'gray-matter';
import { load as loadYaml } from 'js-yaml';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import Navbar from '../app/components/Navbar';
+import { documentdbDiscordUrl } from '../app/services/externalLinks';
+import nav from '../blogs/_data/nav.json';
type Section = 'announcements' | 'blogs';
type Post = { href: string; section: Section; featured: boolean };
@@ -51,11 +53,30 @@ function getPosts(baseurl: string): Post[] {
}));
}
+// [href, label] for every nav.json link in order, dropdown items included
+function expectedNav(baseurl = ''): string[][] {
+ const links = nav.links.flatMap((item) => item.items ?? [item]);
+ return [...links, ...nav.icons].map(({ href, label }) => [
+ /^https?:\/\//.test(href) ? href : `${baseurl}${href}`,
+ label.replace(/&/g, '&'),
+ ]);
+}
+
+function renderedLinks(html: string): string[][] {
+ return [...html.matchAll(/]*\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/g)]
+ .map(([, href, inner]) => [href, inner.replace(/<[^>]+>/g, '').trim()]);
+}
+
describe('main site navigation', () => {
- it('renders separate crawlable links for announcements and blogs', () => {
+ it('renders every nav.json link as a crawlable link, even inside closed dropdowns', () => {
const html = renderToStaticMarkup(createElement(Navbar));
- expect(html).toMatch(/ ]*href="\/announcements\/"[^>]*>Announcements<\/span><\/a>/);
- expect(html).toMatch(/]*href="\/blogs\/"[^>]*>Blogs<\/span><\/a>/);
+ expect(renderedLinks(html).filter(([href]) => href !== '/')).toEqual(expectedNav());
+ });
+
+ it('keeps the Discord invite in step with the other places that link it', () => {
+ const config = loadYaml(fs.readFileSync(path.join(source, '_config.yml'), 'utf8')) as { discord_url?: string };
+ expect(nav.icons.find((link) => link.icon === 'discord')?.href).toBe(documentdbDiscordUrl);
+ expect(config.discord_url).toBe(documentdbDiscordUrl);
});
});
@@ -118,6 +139,16 @@ describe.each([
expect(html).toContain(``);
});
+ it('renders the shared nav in the desktop bar and the mobile menu', () => {
+ for (const page of ['announcements', 'blogs', 'blogs/posts/documentdb-1-0']) {
+ const html = fs.readFileSync(path.join(destination, page, 'index.html'), 'utf8');
+ const desktop = html.match(/([\s\S]*?)