Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/content-indexer/types/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ interface BaseNavItem {
interface PageNavItem extends BaseNavItem {
type: "page";
path: string;
description?: string;
}

interface EndpointNavItem extends BaseNavItem {
type: "endpoint";
path: string;
method: string;
description?: string;
}

interface SectionNavItem extends BaseNavItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ const buildOpenApiNavigation = ({
);

const title = getOperationTitle(operationObj, operation.operationId);
const summary = getOperationSummary(operationObj);

// Build Algolia record if not hidden
if (!isHidden) {
const description = getOperationDescription(operationObj);
const summary = getOperationSummary(operationObj);

const breadcrumbs = apiSectionBreadcrumb
? [...navigationAncestors, apiSectionBreadcrumb]
Expand All @@ -141,6 +141,7 @@ const buildOpenApiNavigation = ({
path: `/${finalPath}`,
method: operation.method,
type: "endpoint" as const,
description: summary,
};
});

Expand Down
9 changes: 6 additions & 3 deletions src/content-indexer/visitors/processors/process-openrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ export const processOpenRpcSpec = ({
tab,
};

const summary =
method.summary ||
(method.description ? removeMd(method.description) : undefined);

// Build Algolia record if not hidden
if (!isHidden) {
const description = method.description
? removeMd(method.description)
: method.summary || "";
const summary =
method.summary ||
(method.description ? removeMd(method.description) : undefined);

const breadcrumbs = apiSectionBreadcrumb
? [...navigationAncestors, apiSectionBreadcrumb]
: navigationAncestors;
Expand All @@ -98,6 +100,7 @@ export const processOpenRpcSpec = ({
path: `/${finalPath}`,
method: "POST",
type: "endpoint",
description: summary,
});
});

Expand Down
10 changes: 6 additions & 4 deletions src/content-indexer/visitors/visit-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,23 @@ export const visitPage = ({
};

// Build nav item (skip if hidden)
const descriptionRaw =
cached?.frontmatter.description || cached?.frontmatter.subtitle;
const description =
typeof descriptionRaw === "string" ? descriptionRaw : undefined;

const navItem: NavItem | undefined = pageItem.hidden
? undefined
: {
title: pageItem.page,
path: `/${finalPath}`,
type: "page",
description,
};

// Build Algolia record (if content available and not hidden)
if (cached && navItem) {
const title = cached.frontmatter.title || pageItem.page;
const descriptionRaw =
cached.frontmatter.description || cached.frontmatter.subtitle;
const description =
typeof descriptionRaw === "string" ? descriptionRaw : undefined;
context.addAlgoliaRecord({
pageType: "Guide",
path: finalPath,
Expand Down
Loading