Minor Changes
-
#162
982a47dThanks @MohamedH1998! - Register API collections from the Nimbus config.apiCollection()now takes no arguments and reads theapientry whosecollectionmatches its key insrc/content.config.ts, so each spec is declared once, in the inline Nimbus config inastro.config.ts:// astro.config.ts const nimbusConfig = defineNimbusConfig({ site: "https://example.com", title: "Example", api: [{ collection: "api", spec: "./src/api/openapi.yaml" }], }); // src/content.config.ts export const collections = { docs: defineCollection(docsCollection()), api: defineCollection(apiCollection()), };
The
api-referencerecipe now uses this shape and no longer createsnimbus.config.ts, sonimbus-docs checkvalidates the whole config statically andadd adapter-cloudflareeditsrenderingin place.A collection key with no
apientry fails content sync, and anapientry without anapiCollection()under its key fails the build, including a key registered with another loader. Both messages name the Nimbus config andsrc/content.config.ts, andnimbus-docs checkreports the same mismatches without building.apiCollection(options)and@cloudflare/nimbus-docs/configare unchanged, and sites built by earlier versions of the recipe keep building with no changes. Upgrade note: inastro dev, that shape silently ignores edits to theapientry innimbus.config.tsuntil a manual restart. To pick up edits automatically, move the Nimbus config back intoastro.config.ts, delete the lookup insrc/content.config.ts, and register the collection withapiCollection().nimbus-docs upgradelists these steps.Also fixes
astro devafter anastro.config.*edit, for every site: collections are re-synced when Astro restarts the dev server, so docs pages keep their partial headings and Markdown routes andllms.txtkeep working, instead of losing prepared data until a manual restart. Spec edits keep re-indexing API pages after that restart. -
#165
05efc7aThanks @MohamedH1998! - Keep more of the OpenAPI document in API reference pages and their Markdown versions:- Request body
requiredanddescription.ApiOperationPagegainsbodyRequired,bodyDescription, andbodyDescriptionHtml, read from the operation's Request Body Object. Each is present only when the spec states it. - Every response media type. The primary media type is chosen exactly as before and is now exposed as
ApiResponseView.mediaType. Each other media type is listed inApiResponseView.additionalMedia(ApiResponseMediaView:mediaType,anchor,fields, and optionaltruncated,union, andexample), with fields citable at<operation>.response.<status>.<media-token>.<field>. The build no longer warns that it renders only the first media type. A media type whose coordinate token would clash, with a sibling media type (such asapplication/vnd.a+jsonbesideapplication/vnd.a-json) or with a field of the primary body (a property namedtext-csvbesidetext/csv), no longer fails the build, for responses or request bodies: it gets a short hash suffix instead. Media types that don't clash keep their existing coordinates. - Readable union branch labels. A
oneOf/anyOfbranch without a$refis labeled by itstitle, then by the type of its foldedallOf, then by the type of itsenum/constvalues, thenobjectwhen it has properties, and otherwiseOption N. Branches are never labeledunknown. Field types are unchanged.
The generated Markdown shows the body's required flag and description, one labeled body per response media type, and the new branch labels. All changes are additive, and
apiSchemaVersionstays1. Pages whose spec uses none of these constructs render the same HTML and Markdown as before. - Request body
-
#164
b8f4d05Thanks @MohamedH1998! - Return each page's URLs from the page helpers, build OG cards from one path function, and reduce thellms.txtroutes to one factory call each.-
getDocsPage,getCollectionPage,getDocsPageProps, andgetCollectionPagePropsnow returnmarkdownUrl,sourceUrl, andogImageUrlalongsideentry,Content, andheadings.IndexedEntrygainsogImageUrl. All three are site-relative with no base path and come from the same function, so a page route no longer builds them by hand:const { entry, Content, headings, markdownUrl, ogImageUrl } = page; const socialImage = entry.data.socialImage ?? ogImageUrl;
-
getOgImagePages()from@cloudflare/nimbus-docs/runtimereturns thepagesmap for astro-og-canvas'sOGImageRoute, one entry per indexed page, keyed so each card is written at the page'sogImageUrl.ogImageUrlis/og/<page>.png, derived from the page's route, the same rule theapi-referencerecipe uses. This fixes broken OG cards: collection and version root pages, such as/blog/, linked to/og/blog/index.pngwhile the card was written at/og/blog.png, and IDs containing a dot, such asv1.2/guideor the webhookpayment.succeeded, had their card name cut at the last dot, so several pages shared one card. noindex pages linked to/og/<id>.png, but the old OG route skipped them and never wrote that card. Root pages, dotted IDs, and noindex pages now link to cards that exist. -
llmsRoute(),llmsFullRoute(), andllmsSectionRoute()from@cloudflare/nimbus-docs/agent-endpointsreturn the{ GET }behindsrc/pages/llms.txt.tsandllms-full.txt.ts, and the{ GET, getStaticPaths }behindsrc/pages/[section]/llms.txt.ts. EachGETreturns 404 for a missing or unknown index and, on request, a 500 without details when the index can't be read, as the starter's routes did:// src/pages/[section]/llms.txt.ts import { llmsSectionRoute } from "@cloudflare/nimbus-docs/agent-endpoints"; export const prerender = true; export const { GET, getStaticPaths } = llmsSectionRoute();
-
The build now warns about every baked Markdown page and every
llms.txtindex that no prerendered route generated, and names the route that serves it. This catches a shared Markdown route that re-exportsmarkdownRoute()from another module and is rendered on request. Sites that serve these pages on request on purpose can ignore the warning.
Hand-built URLs, existing OG routes, and existing
llms.txtroutes keep building with unchanged output. Thepage-urls-and-llms-routesupgrade entry lists the lines each route can drop. -
-
#161
b45ca22Thanks @MohamedH1998! - Serve the Markdown and source versions of every collection from two route files.markdownRoute()andmarkdownSourceRoute()from@cloudflare/nimbus-docs/agent-endpointsreturn{ GET, getStaticPaths }:// src/pages/[...slug]/index.md.ts import { markdownRoute } from "@cloudflare/nimbus-docs/agent-endpoints"; export const prerender = true; export const { GET, getStaticPaths } = markdownRoute();
- One shared route serves every collection's
/<page>/index.md, including docs versions and API reference pages.markdownSourceRoute()serves/<page>/index.mdxfor every authored page. Collections added later need no new route files. - A more specific route file, such as
src/pages/changelog/[...slug]/index.md.ts, takes over its collection. The shared route skips every URL that route matches, so Astro reports no route conflicts. If the more specific route doesn't generate every page it matches, the build warns and names the missing paths, or fails whenprerenderConflictBehavioris"error". - The shared routes must be prerendered. The build fails if a route using
markdownRoute()ormarkdownSourceRoute()is rendered on request. - API pages now have baked Markdown assets, so
getMarkdownStaticPaths({ collection: "<api>" })returns their entries. Hidden API versions are excluded, like hidden docs versions.
Existing per-collection routes keep working and need no change. Sites that delete the
api-referencerecipe'ssrc/pages/<api>/[...slug]/index.md.tsno longer publish Markdown for hidden API versions. Theshared-markdown-routesupgrade entry explains how to remove unmodified per-collection routes. - One shared route serves every collection's
Patch Changes
-
#164
c26b52bThanks @MohamedH1998! - Support dotted version slugs such asv1.2. Links to a dotted version root now keep their trailing slash (/v1.2/, not/v1.2) in the sidebar, breadcrumbs, version picker, alternate links, andIndexedEntry.url; before, the last segment was read as a file extension.src/content.config.tskeys such as"docs-v1.2"are now recognized, so Nimbus no longer warns that collections can't be identified statically and keeps its collection checks on. -
#167
2223c45Thanks @MohamedH1998! - Keep builds running when an upgrade range contains only optional guidance, while surfacing those entries in the build log and upgrade commands. -
#166
9eef696Thanks @MohamedH1998! - When GitHub refuses the template lookup (or rejects the token) innimbus-docs outdatedordiff, the error now explains how to fix it: setGIGET_AUTHto a GitHub token, or skip the lookup with--toor--template-dir. It also says when GitHub's rate limit resets, or quotes GitHub's reason. The CLI help now mentionsGIGET_AUTH.