Skip to content

Commit 4a83a07

Browse files
lionelcLei Jiang
andauthored
LLM-friendly Optimizations throughout the site (#266)
* disambiguation article * tag edit * Update download_packages.sh permission change * revert the permission change * add agent-kit link * Misc changes for website optimization Throughout the repo in agent-friendly efforts. Not actual content update for now (that needs more deliberation). * Fix pipeline errors --------- Co-authored-by: Lei Jiang <jianglei@microsoft.com>
1 parent f524492 commit 4a83a07

22 files changed

Lines changed: 490 additions & 20 deletions

‎.github/scripts/download_packages.sh‎

100755100644
File mode changed.

‎.github/workflows/continuous-deployment.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ jobs:
184184
GH_TOKEN: ${{ github.token }}
185185
run: |
186186
set -euo pipefail
187-
.github/scripts/download_packages.sh
188-
SUITE=latest DOCUMENTDB_VERSION="$DOCUMENTDB_LATEST_VERSION" .github/scripts/download_packages.sh
187+
bash .github/scripts/download_packages.sh
188+
SUITE=latest DOCUMENTDB_VERSION="$DOCUMENTDB_LATEST_VERSION" bash .github/scripts/download_packages.sh
189189
- name: Verify generated package components
190190
if: steps.features.outputs.packages == 'true'
191191
env:

‎.github/workflows/continuous-integration.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ jobs:
102102
GH_TOKEN: ${{ github.token }}
103103
run: |
104104
set -euo pipefail
105-
.github/scripts/download_packages.sh
105+
bash .github/scripts/download_packages.sh
106106
# Unpinned, like the deploy while DOCUMENTDB_LATEST_VERSION is unset.
107-
SUITE=latest DOCUMENTDB_VERSION=latest .github/scripts/download_packages.sh
107+
SUITE=latest DOCUMENTDB_VERSION=latest bash .github/scripts/download_packages.sh
108108
- name: Verify release inventory and metadata
109109
run: python3 .github/scripts/verify_package_inventory.py
110110
- name: Resolve both PostgreSQL majors and retired endpoints

‎AGENTS.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- BEGIN:nextjs-agent-rules -->
2+
3+
## This is NOT the Next.js you know
4+
5+
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
6+
7+
This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
8+
9+
<!-- END:nextjs-agent-rules -->

‎app/ai/page.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const useCases = [
156156
description:
157157
"Store chunks, metadata, and embeddings together so retrieval stays close to the source document.",
158158
points: [
159-
"Pre-filter by category, source, or recency before retrieval",
159+
"Combine vector retrieval with indexed metadata filters; result counts are best-effort",
160160
"Return source text alongside similarity scores",
161161
],
162162
sampleId: "hotel-agent-ts",
@@ -438,6 +438,11 @@ export default function AIPage() {
438438
title="Built for the AI workloads that matter"
439439
description="Vector retrieval, document storage, and query power in one system — ready for the patterns teams are actually shipping."
440440
/>
441+
<p className="mb-6 max-w-3xl text-sm leading-6 text-gray-300">
442+
Vector filters intersect approximate nearest-neighbor results: filter paths must be indexed,
443+
counts are best-effort, and filtered search is unsupported on sharded collections.{" "}
444+
<Link href={vectorSearchReference} className={textLinkClass}>Read the vector search limitations</Link>
445+
</p>
441446
<div className="grid gap-4 md:grid-cols-2">
442447
{useCases.map((item) => {
443448
const link = useCaseLink(item);
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import Link from "next/link";
2+
import CommandSnippet from "./CommandSnippet";
3+
import TelemetryNote from "./TelemetryNote";
4+
import { buildAptInstallCommand, buildRpmInstallCommand, buildSetupCommand } from "../lib/packageInstall";
5+
6+
const linkClass = "text-blue-300 underline underline-offset-4";
7+
8+
export default function StaticInstallGuides() {
9+
return (
10+
<section aria-label="Static installation quickstarts" className="space-y-6 rounded-xl border border-neutral-700 bg-neutral-800/60 p-4 sm:p-6">
11+
<h2 className="text-2xl font-bold text-white">Install without the selector</h2>
12+
<p className="text-sm leading-6 text-gray-300">
13+
These are standalone quickstarts, not commands customized from this URL.
14+
Choose the guide matching your environment. The interactive selector loads separately.
15+
</p>
16+
<div className="space-y-3">
17+
<h3 className="text-xl font-semibold text-white">Docker: local evaluation and development</h3>
18+
<p className="text-sm text-gray-300">Requires Docker and an available port 10260. Replace both credential placeholders before running.</p>
19+
<CommandSnippet label="Start local Docker container" command={`docker run -dt --pull always --name documentdb \\
20+
-p 127.0.0.1:10260:10260 \\
21+
-e USERNAME='<YOUR_USERNAME>' \\
22+
-e PASSWORD='<YOUR_PASSWORD>' \\
23+
ghcr.io/documentdb/documentdb/documentdb-local:latest`} />
24+
<TelemetryNote />
25+
<p className="text-sm text-gray-300">
26+
Wait for <code>=== DocumentDB is ready ===</code> in <code>docker logs documentdb</code>, then follow the{" "}
27+
<Link href="/docs/getting-started/docker" className={linkClass}>Docker quickstart</Link> to connect and verify.
28+
</p>
29+
</div>
30+
<div className="space-y-3">
31+
<h3 className="text-xl font-semibold text-white">Linux packages: a new PostgreSQL 18 instance</h3>
32+
<p className="text-sm text-gray-300">
33+
Requires a supported Linux host, sudo and internet access. These commands use the moving <code>latest</code> channel and detect host architecture.
34+
For an existing installation, <Link href="/docs/linux-packages#upgrading" className={linkClass}>upgrade in place</Link> instead.
35+
</p>
36+
<details>
37+
<summary className="cursor-pointer text-blue-300">Ubuntu 24.04 (AMD64 or ARM64)</summary>
38+
<CommandSnippet label="Ubuntu 24.04 install" command={buildAptInstallCommand("ubuntu24", "auto", "18")} />
39+
</details>
40+
<details>
41+
<summary className="cursor-pointer text-blue-300">Registered RHEL 9 (AMD64 or ARM64)</summary>
42+
<CommandSnippet label="RHEL 9 install" command={buildRpmInstallCommand("rhel9", "auto", "18")} />
43+
</details>
44+
<details>
45+
<summary className="cursor-pointer text-blue-300">Rocky Linux 9 (AMD64 or ARM64)</summary>
46+
<CommandSnippet label="Rocky Linux 9 install" command={buildRpmInstallCommand("rocky9", "auto", "18")} />
47+
</details>
48+
<p className="text-sm text-gray-300">
49+
Firewall port 10260 before setup: the gateway listens on all interfaces.
50+
Setup asks for an admin password and starts a private PostgreSQL instance.
51+
</p>
52+
<CommandSnippet label="Set up PostgreSQL 18" command={buildSetupCommand("18")} />
53+
<p className="text-sm text-gray-300">
54+
Check <code>sudo documentdb-setup --status</code>, then follow the{" "}
55+
<Link href="/docs/getting-started/packages" className={linkClass}>Linux packages quickstart</Link> for connection, first-query verification, troubleshooting and cleanup.
56+
</p>
57+
</div>
58+
</section>
59+
);
60+
}

‎app/components/StructuredData.tsx‎

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { siteUrl } from "../services/metadataService";
2+
3+
export const softwareId = `${siteUrl}/#software`;
4+
5+
export const projectStructuredData = {
6+
"@context": "https://schema.org",
7+
"@graph": [
8+
{
9+
"@type": "Organization",
10+
"@id": `${siteUrl}/#project`,
11+
name: "DocumentDB",
12+
url: `${siteUrl}/`,
13+
parentOrganization: {
14+
"@type": "Organization",
15+
name: "The Linux Foundation",
16+
url: "https://www.linuxfoundation.org/",
17+
},
18+
},
19+
{
20+
"@type": "SoftwareSourceCode",
21+
"@id": softwareId,
22+
name: "DocumentDB",
23+
description: "An MIT-licensed, open-source, MongoDB-compatible document database built on PostgreSQL.",
24+
url: `${siteUrl}/`,
25+
codeRepository: "https://github.com/documentdb/documentdb",
26+
license: "https://opensource.org/license/mit",
27+
programmingLanguage: ["C", "Rust"],
28+
publisher: { "@id": `${siteUrl}/#project` },
29+
},
30+
{
31+
"@type": "WebSite",
32+
"@id": `${siteUrl}/#website`,
33+
name: "DocumentDB",
34+
url: `${siteUrl}/`,
35+
about: { "@id": softwareId },
36+
publisher: { "@id": `${siteUrl}/#project` },
37+
},
38+
],
39+
};
40+
41+
export function articleStructuredData({
42+
title, description, path, breadcrumbs, dateModified,
43+
}: {
44+
title: string;
45+
description?: string;
46+
path: string;
47+
breadcrumbs: { name: string; path: string }[];
48+
dateModified?: string;
49+
}) {
50+
const url = new URL(path, siteUrl).href;
51+
return {
52+
"@context": "https://schema.org",
53+
"@graph": [
54+
{
55+
"@type": "TechArticle",
56+
"@id": `${url}#article`,
57+
headline: title,
58+
description,
59+
url,
60+
mainEntityOfPage: url,
61+
inLanguage: "en",
62+
about: { "@id": softwareId },
63+
isPartOf: { "@id": `${siteUrl}/#website` },
64+
publisher: { "@id": `${siteUrl}/#project` },
65+
...(dateModified ? { dateModified } : {}),
66+
},
67+
{
68+
"@type": "BreadcrumbList",
69+
itemListElement: breadcrumbs.map((item, index) => ({
70+
"@type": "ListItem",
71+
position: index + 1,
72+
name: item.name,
73+
item: new URL(item.path, siteUrl).href,
74+
})),
75+
},
76+
],
77+
};
78+
}
79+
80+
export default function StructuredData({ data }: { data: object }) {
81+
return (
82+
<script
83+
type="application/ld+json"
84+
dangerouslySetInnerHTML={{ __html: JSON.stringify(data).replace(/</g, "\\u003c") }}
85+
/>
86+
);
87+
}

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import Link from "next/link";
22
import { notFound } from 'next/navigation';
33
import { capitalCase } from 'change-case';
44
import { getAllArticlePaths, getArticleByPath } from "../../../services/articleService";
5-
import { getMetadata } from "../../../services/metadataService";
5+
import { getMetadata, getModifiedTime } from "../../../services/metadataService";
6+
import StructuredData, { articleStructuredData } from "../../../components/StructuredData";
67
import ComingSoon from "../../../components/ComingSoon";
78
import CommandSnippet from "../../../components/CommandSnippet";
89
import TelemetryNote from "../../../components/TelemetryNote";
@@ -96,6 +97,8 @@ export async function generateMetadata({ params }: PageProps) {
9697
description: frontmatter.description || '',
9798
path: slug.length > 0 ? `/docs/${section}/${slug.join('/')}/` : `/docs/${section}/`,
9899
type: 'article',
100+
modifiedTime: getModifiedTime(frontmatter.last_modified_at),
101+
noindex: frontmatter.layout === 'coming-soon',
99102
});
100103
}
101104

@@ -114,6 +117,7 @@ export default async function ArticlePage({ params }: PageProps) {
114117
}
115118

116119
const { content, frontmatter, navigation, file } = articleData;
120+
const modifiedTime = getModifiedTime(frontmatter.last_modified_at);
117121
const selectedNavItem = navigation.find((item) =>
118122
item.link.includes(file)
119123
);
@@ -130,6 +134,7 @@ export default async function ArticlePage({ params }: PageProps) {
130134
const sectionTitle = capitalCase(section)
131135
.replace(/documentdb/i, 'DocumentDB')
132136
.replace(/api/i, 'API');
137+
const pagePath = slug.length > 0 ? `/docs/${section}/${slug.join('/')}/` : `/docs/${section}/`;
133138

134139
// Rendered once, shown in the desktop sidebar and the mobile disclosure
135140
const navigationLinks = navigation.map((item) => {
@@ -160,6 +165,18 @@ export default async function ArticlePage({ params }: PageProps) {
160165

161166
return (
162167
<div className="min-h-screen bg-neutral-900 relative overflow-hidden">
168+
{!isComingSoon && <StructuredData data={articleStructuredData({
169+
title: pageTitle,
170+
description: frontmatter.description,
171+
path: pagePath,
172+
dateModified: modifiedTime,
173+
breadcrumbs: [
174+
{ name: 'Home', path: '/' },
175+
{ name: 'Documentation', path: '/docs/' },
176+
...(slug.length > 0 ? [{ name: sectionTitle, path: `/docs/${section}/` }] : []),
177+
{ name: pageTitle, path: pagePath },
178+
],
179+
})} />}
163180
{/* Background elements */}
164181
<div className="absolute inset-0 bg-gradient-to-br from-neutral-900 via-neutral-800 to-black"></div>
165182
<div className="absolute inset-0 opacity-5">
@@ -236,6 +253,12 @@ export default async function ArticlePage({ params }: PageProps) {
236253
</h1>
237254
)}
238255
{isComingSoon && <ComingSoon />}
256+
{modifiedTime && (
257+
<p className="mb-4 text-sm text-gray-300">
258+
Last updated: <time dateTime={modifiedTime}>{modifiedTime.slice(0, 10)}</time>.
259+
{frontmatter.applies_to ? ` ${frontmatter.applies_to}` : ''}
260+
</p>
261+
)}
239262

240263
{showInstallPrimer && (
241264
<section className="mb-8 rounded-2xl border border-blue-500/30 bg-gradient-to-br from-blue-500/10 via-neutral-900/90 to-neutral-900/90 p-6">

‎app/docs/page.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export default function Docs() {
5656
<p className="text-xl text-gray-400 max-w-3xl mx-auto mb-8">
5757
{articleContent.landing.description}
5858
</p>
59+
<p className="text-sm text-gray-300 mb-6">
60+
Documentation for the open-source project, not similarly named managed services.{" "}
61+
<Link href="/blogs/posts/documentdb-name-disambiguation/" className="text-blue-300 underline underline-offset-4">DocumentDB naming guide</Link>
62+
</p>
5963
<div className="w-32 h-1 bg-gradient-to-r from-blue-500 via-purple-500 to-green-500 mx-auto rounded-full"></div>
6064
</div>
6165

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { notFound } from 'next/navigation';
22
import Breadcrumb from '../../../../../components/Breadcrumb';
33
import Markdown from '../../../../../components/Markdown';
44
import { getAllReferenceParams, getReferenceByPath } from '../../../../../services/referenceService';
5-
import { getMetadata } from "../../../../../services/metadataService";
5+
import { getMetadata, getModifiedTime } from "../../../../../services/metadataService";
6+
import StructuredData, { articleStructuredData } from "../../../../../components/StructuredData";
67

78
export async function generateMetadata({ params }: { params: Promise<{ type: string; category: string; name: string }> }) {
89
const { type, category, name } = await params;
@@ -22,6 +23,7 @@ export async function generateMetadata({ params }: { params: Promise<{ type: str
2223
description: data.frontmatter.description || '',
2324
path: `/docs/reference/${type}/${category}/${name}/`,
2425
type: 'article',
26+
modifiedTime: getModifiedTime(data.frontmatter.last_modified_at),
2527
extraKeywords: ['reference', type, category, name]
2628
});
2729
}
@@ -44,6 +46,20 @@ export default async function ReferencePage({ params }: { params: Promise<{ type
4446

4547
return (
4648
<article>
49+
<StructuredData data={articleStructuredData({
50+
title: pageTitle,
51+
description: pageDescription,
52+
path: `/docs/reference/${type}/${category}/${name}/`,
53+
dateModified: getModifiedTime(data.frontmatter.last_modified_at),
54+
breadcrumbs: [
55+
{ name: 'Home', path: '/' },
56+
{ name: 'Documentation', path: '/docs/' },
57+
{ name: 'MQL Reference', path: '/docs/reference/' },
58+
{ name: type, path: `/docs/reference/${type}/` },
59+
{ name: category, path: `/docs/reference/${type}/${category}/` },
60+
{ name: pageTitle, path: `/docs/reference/${type}/${category}/${name}/` },
61+
],
62+
})} />
4763
<Breadcrumb type={type} category={category} name={pageTitle} />
4864

4965
{/* Markdown Content */}

0 commit comments

Comments
 (0)