Skip to content

Commit 79dd7d4

Browse files
committed
docs: fix sidebar overflow at mid-width viewports and add a favicon
The --vp-layout-max-width: 1680px override interacts badly with the default theme's (min-width: 1440px) rules, which assume the layout max width never exceeds 1440px: on viewports between 1440px and 1680px their calc() goes negative, collapsing the sidebar and spilling the nav title over the search bar. Clamp the override to the viewport (min(100vw, 1680px)) so those rules resolve to their stock values on narrower viewports. Also add the MCP logo favicon (the same asset the Python SDK docs use) to both the v2 and v1 sites. The v1 site's content/ is build-generated, so build-docs-site.sh copies the shared asset into its public dir.
1 parent 7635115 commit 79dd7d4

5 files changed

Lines changed: 28 additions & 1 deletion

File tree

docs/.vitepress/config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export default defineConfig({
3030
title: 'MCP TypeScript SDK',
3131
description: 'The TypeScript SDK implementation of the Model Context Protocol specification.',
3232
base: '/v2/',
33+
// VitePress does not base-prefix head hrefs, so /v2/ is spelled out here.
34+
head: [['link', { rel: 'icon', type: 'image/svg+xml', href: '/v2/favicon.svg' }]],
3335
srcExclude: ['v1/**', '_meta/**', 'behavior-surface-pins.md'],
3436
sitemap: { hostname: `${siteUrl}/` },
3537
markdown: {

docs/.vitepress/theme/custom.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@
1313
* which forces horizontal scrolling on most of our ~100-column code blocks.
1414
* Let the layout breathe and the column grow so typical snippets fit;
1515
* genuinely long lines still scroll inside their own block.
16+
*
17+
* Clamped to the viewport because the default theme's `(min-width: 1440px)`
18+
* rules size the sidebar and nav title as
19+
* `calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + ...)`, which goes
20+
* negative on viewports narrower than the max width: the sidebar collapses
21+
* and the site title spills over the search bar. With the clamp, those rules
22+
* resolve to their stock sub-1440px values on narrower viewports instead.
1623
*/
1724
:root {
18-
--vp-layout-max-width: 1680px;
25+
--vp-layout-max-width: min(100vw, 1680px);
1926
}
2027

2128
/* !important: the default rule is a scoped component style ([data-v-…]), which

docs/public/favicon.svg

Lines changed: 11 additions & 0 deletions
Loading

docs/v1/.vitepress/config.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export default defineConfig({
2424
title: 'MCP TypeScript SDK (v1)',
2525
description: 'Documentation for v1.x of the MCP TypeScript SDK.',
2626
base: '/',
27+
// The favicon is copied into content/public/ by scripts/build-docs-site.sh
28+
// (content/ is generated; the committed source is docs/public/favicon.svg).
29+
head: [['link', { rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' }]],
2730
sitemap: { hostname: 'https://ts.sdk.modelcontextprotocol.io' },
2831
srcDir: 'content',
2932
markdown: {

scripts/build-docs-site.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ npx typedoc --options typedoc.v1-site.json
9999
cp docs/*.md "$V1_CONTENT/"
100100
cp README.md "$V1_CONTENT/index.md"
101101

102+
# The v1 site serves the shared favicon at its own root (see docs/v1/.vitepress/config.mts).
103+
mkdir -p "$V1_CONTENT/public"
104+
cp "$REPO_ROOT/docs/public/favicon.svg" "$V1_CONTENT/public/favicon.svg"
105+
102106
# Rewrite links that don't resolve on the site:
103107
# - source files -> GitHub
104108
# - README links into docs/ -> site-local pages (docs/*.md sit next to index.md in content/)

0 commit comments

Comments
 (0)