diff --git a/fern/apis/fdr/definition/docs/v1/db/__package__.yml b/fern/apis/fdr/definition/docs/v1/db/__package__.yml index 7520f5a809..eaae9d2d6b 100644 --- a/fern/apis/fdr/definition/docs/v1/db/__package__.yml +++ b/fern/apis/fdr/definition/docs/v1/db/__package__.yml @@ -59,6 +59,7 @@ types: root: optional navbarLinks: optional> footerLinks: optional> + hideNavLinks: optional # logo logoHeight: optional diff --git a/fern/apis/fdr/definition/docs/v1/read/__package__.yml b/fern/apis/fdr/definition/docs/v1/read/__package__.yml index f9ad0af875..b821b56465 100644 --- a/fern/apis/fdr/definition/docs/v1/read/__package__.yml +++ b/fern/apis/fdr/definition/docs/v1/read/__package__.yml @@ -98,6 +98,7 @@ types: root: optional navbarLinks: optional> footerLinks: optional> + hideNavLinks: optional # logo logoHeight: optional diff --git a/fern/apis/fdr/definition/docs/v1/write/__package__.yml b/fern/apis/fdr/definition/docs/v1/write/__package__.yml index a4c0be7e1b..ac4dc96d5c 100644 --- a/fern/apis/fdr/definition/docs/v1/write/__package__.yml +++ b/fern/apis/fdr/definition/docs/v1/write/__package__.yml @@ -93,6 +93,7 @@ types: root: optional navbarLinks: optional> footerLinks: optional> + hideNavLinks: optional # logo logoHeight: optional diff --git a/packages/commons/fdr-utils/src/definition-object-factory.ts b/packages/commons/fdr-utils/src/definition-object-factory.ts index ce483172e6..df80caa232 100644 --- a/packages/commons/fdr-utils/src/definition-object-factory.ts +++ b/packages/commons/fdr-utils/src/definition-object-factory.ts @@ -22,6 +22,7 @@ export class DefinitionObjectFactory { }, navbarLinks: [], navigation: { items: [], landingPage: undefined }, + hideNavLinks: undefined, root: undefined, title: undefined, defaultLanguage: undefined, diff --git a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/db/types/DocsDbConfig.ts b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/db/types/DocsDbConfig.ts index 2e9a8caba7..cc284601e4 100644 --- a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/db/types/DocsDbConfig.ts +++ b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/db/types/DocsDbConfig.ts @@ -12,6 +12,7 @@ export interface DocsDbConfig { root: FernRegistry.navigation.v1.RootNode | undefined; navbarLinks: FernRegistry.docs.v1.commons.NavbarLink[] | undefined; footerLinks: FernRegistry.docs.v1.commons.FooterLink[] | undefined; + hideNavLinks: boolean | undefined; logoHeight: FernRegistry.docs.v1.read.Height | undefined; logoHref: FernRegistry.Url | undefined; favicon: FernRegistry.FileId | undefined; diff --git a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/read/types/DocsConfig.ts b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/read/types/DocsConfig.ts index a549e434ee..177623a6c4 100644 --- a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/read/types/DocsConfig.ts +++ b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/read/types/DocsConfig.ts @@ -12,6 +12,7 @@ export interface DocsConfig { root: FernRegistry.navigation.v1.RootNode | undefined; navbarLinks: FernRegistry.docs.v1.commons.NavbarLink[] | undefined; footerLinks: FernRegistry.docs.v1.commons.FooterLink[] | undefined; + hideNavLinks: boolean | undefined; logoHeight: FernRegistry.docs.v1.read.Height | undefined; logoHref: FernRegistry.Url | undefined; favicon: FernRegistry.FileId | undefined; diff --git a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/client/Client.ts b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/client/Client.ts index 272d624b68..9454a536fa 100644 --- a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/client/Client.ts +++ b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/client/Client.ts @@ -205,6 +205,7 @@ export class Write { * "key": "value" * } * }], + * hideNavLinks: true, * logoHeight: 1.1, * logoHref: FernRegistry.Url("string"), * favicon: FernRegistry.FileId("string"), diff --git a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/client/requests/RegisterDocsRequest.ts b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/client/requests/RegisterDocsRequest.ts index dbdc2d136f..9013997412 100644 --- a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/client/requests/RegisterDocsRequest.ts +++ b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/client/requests/RegisterDocsRequest.ts @@ -124,6 +124,7 @@ import * as FernRegistry from "../../../../../../../../index"; * "key": "value" * } * }], + * hideNavLinks: true, * logoHeight: 1.1, * logoHref: FernRegistry.Url("string"), * favicon: FernRegistry.FileId("string"), diff --git a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/types/DocsConfig.ts b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/types/DocsConfig.ts index a5be303dd5..5f809a6c61 100644 --- a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/types/DocsConfig.ts +++ b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/types/DocsConfig.ts @@ -12,6 +12,7 @@ export interface DocsConfig { root: FernRegistry.navigation.v1.RootNode | undefined; navbarLinks: FernRegistry.docs.v1.commons.NavbarLink[] | undefined; footerLinks: FernRegistry.docs.v1.commons.FooterLink[] | undefined; + hideNavLinks: boolean | undefined; logoHeight: FernRegistry.docs.v1.write.Height | undefined; logoHref: FernRegistry.Url | undefined; favicon: FernRegistry.FileId | undefined; diff --git a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v2/resources/write/client/Client.ts b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v2/resources/write/client/Client.ts index 6f79369d80..1409a0e827 100644 --- a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v2/resources/write/client/Client.ts +++ b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v2/resources/write/client/Client.ts @@ -309,6 +309,7 @@ export class Write { * "key": "value" * } * }], + * hideNavLinks: true, * logoHeight: 1.1, * logoHref: FernRegistry.Url("string"), * favicon: FernRegistry.FileId("string"), diff --git a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v2/resources/write/client/requests/RegisterDocsRequest.ts b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v2/resources/write/client/requests/RegisterDocsRequest.ts index dbdc2d136f..9013997412 100644 --- a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v2/resources/write/client/requests/RegisterDocsRequest.ts +++ b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v2/resources/write/client/requests/RegisterDocsRequest.ts @@ -124,6 +124,7 @@ import * as FernRegistry from "../../../../../../../../index"; * "key": "value" * } * }], + * hideNavLinks: true, * logoHeight: 1.1, * logoHref: FernRegistry.Url("string"), * favicon: FernRegistry.FileId("string"), diff --git a/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts b/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts index e9d4b7bd98..3a54f742b0 100644 --- a/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts +++ b/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts @@ -110,6 +110,7 @@ export function convertDocsDefinitionToDb({ : undefined, navbarLinks: writeShape.config.navbarLinks, footerLinks: writeShape.config.footerLinks, + hideNavLinks: writeShape.config.hideNavLinks, title: writeShape.config.title, favicon: writeShape.config.favicon, backgroundImage: writeShape.config.backgroundImage, diff --git a/packages/fdr-sdk/src/converters/read/convertDbDocsConfigToRead.ts b/packages/fdr-sdk/src/converters/read/convertDbDocsConfigToRead.ts index e3d2903e63..f15ded3b0f 100644 --- a/packages/fdr-sdk/src/converters/read/convertDbDocsConfigToRead.ts +++ b/packages/fdr-sdk/src/converters/read/convertDbDocsConfigToRead.ts @@ -29,6 +29,7 @@ export function convertDbDocsConfigToRead({ colorsV3: dbShape.colorsV3 ?? getColorsV3(dbShape), navbarLinks: dbShape.navbarLinks, footerLinks: dbShape.footerLinks, + hideNavLinks: dbShape.hideNavLinks, title: dbShape.title, favicon: dbShape.favicon, typographyV2: diff --git a/packages/fdr-sdk/src/navigation/NodeCollector.ts b/packages/fdr-sdk/src/navigation/NodeCollector.ts index b871ee2d83..b99a33f4aa 100644 --- a/packages/fdr-sdk/src/navigation/NodeCollector.ts +++ b/packages/fdr-sdk/src/navigation/NodeCollector.ts @@ -2,6 +2,7 @@ import { EMPTY_ARRAY } from "@fern-api/ui-core-utils"; import { once } from "es-toolkit/function"; import { FernNavigation } from "./.."; import { pruneVersionNode } from "./utils/pruneVersionNode"; +import { NavigationNodeWithMetadata } from "./versions"; interface NavigationNodeWithMetadataAndParents { node: FernNavigation.NavigationNodeWithMetadata; @@ -134,7 +135,6 @@ export class NodeCollector { this.#setNode(node.slug, node, parents); } else { if (FernNavigation.isPage(existing.node)) { - // eslint-disable-next-line no-console console.warn(`Duplicate slug found: ${node.slug}`, node.title); } this.orphanedNodes.push(node); @@ -236,6 +236,29 @@ export class NodeCollector { return this.#getIndexablePageSlugs(); } + #getIndexablePageNodesWithAuth = once((): NavigationNodeWithMetadata[] => { + const slugRecord: Record = {}; + + [...this.slugToNode.values()] + .filter(({ node }) => FernNavigation.isPage(node)) + .filter(({ node }) => !node.hidden) + .filter(({ node }) => + FernNavigation.hasMarkdown(node) ? !node.noindex : true + ) + .forEach((node) => { + const canonicalSlug = node.node.canonicalSlug ?? node.node.slug; + // Only keep the first node we see for each canonical slug + if (!(canonicalSlug in slugRecord)) { + slugRecord[canonicalSlug] = node.node; + } + }); + + return Object.values(slugRecord); + }); + get indexablePageNodesWithAuth(): NavigationNodeWithMetadata[] { + return this.#getIndexablePageNodesWithAuth(); + } + public getVersionNodes = (): FernNavigation.VersionNode[] => { return this.versionNodes; }; diff --git a/packages/fern-docs/components/src/CopyToClipboardButton.tsx b/packages/fern-docs/components/src/CopyToClipboardButton.tsx index 3e651533a9..e613b4faf9 100644 --- a/packages/fern-docs/components/src/CopyToClipboardButton.tsx +++ b/packages/fern-docs/components/src/CopyToClipboardButton.tsx @@ -40,7 +40,7 @@ export const CopyToClipboardButton: React.FC = ({ copyToClipboard?.(); }) ?? ( { onClick?.(e); diff --git a/packages/fern-docs/components/src/__test__/__snapshots__/CopyToClipboardButton.test.tsx.snap b/packages/fern-docs/components/src/__test__/__snapshots__/CopyToClipboardButton.test.tsx.snap index 861f37e221..94d5d20daa 100644 --- a/packages/fern-docs/components/src/__test__/__snapshots__/CopyToClipboardButton.test.tsx.snap +++ b/packages/fern-docs/components/src/__test__/__snapshots__/CopyToClipboardButton.test.tsx.snap @@ -3,7 +3,7 @@ exports[`CopyToClipboardButton > renders correctly 1`] = `