Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doc nav to handle order #3379

Merged
merged 6 commits into from
Nov 13, 2024
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: 1 addition & 1 deletion astro/src/content/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const docsCollection = defineCollection({
quatercategory: z.string().optional(),
nestedHeadings: z.boolean().optional(),
disableTOC: z.boolean().default(false),
topOfNav: z.boolean().default(false),
navOrder: z.number().default(1000),
idpDisplayName: z.string().optional(),
}),
});
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/apis/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: API Authentication
description: Learn how the FusionAuth APIs authenticate requests.
section: apis
topOfNav: true
navOrder: 0
---
import APIAuthenticationIcon from "src/components/api/APIAuthenticationIcon.astro";
import APIBlock from 'src/components/api/APIBlock.astro';
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/apis/connectors/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Overview
description: Learn about the APIs for creating, retrieving, updating and deleting identity providers.
section: apis
subcategory: connectors
topOfNav: true
navOrder: 0
---
import PremiumPlanBlurb from 'src/content/docs/_shared/_premium-plan-blurb.astro';
import API from 'src/components/api/API.astro';
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/apis/entities/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Overview
description: Learn about the APIs for creating, retrieving, updating and deleting entities and entity types.
section: apis
subcategory: entities
topOfNav: true
navOrder: 0
---
import PremiumPlanBlurb from 'src/content/docs/_shared/_premium-plan-blurb.astro';

Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/apis/identity-providers/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Overview
description: Learn about the APIs for creating, retrieving, updating and deleting identity providers.
section: apis
subcategory: identity providers
topOfNav: true
navOrder: 0
---
import API from 'src/components/api/API.astro';
import StandardGetResponseCodes from 'src/content/docs/apis/_standard-get-response-codes.astro';
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/apis/messengers/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Overview
description: Learn about the APIs for creating, retrieving, updating and deleting messengers.
section: apis
subcategory: messengers
topOfNav: true
navOrder: 0
---
import API from 'src/components/api/API.astro';
import APIBlock from 'src/components/api/APIBlock.astro';
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/apis/scim/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Overview
description: Learn about the APIs for provisioning SCIM Resources in FusionAuth using a SCIM Client.
section: apis
subcategory: scim
topOfNav: true
navOrder: 0
---
import EnterprisePlanBlurb from 'src/content/docs/_shared/_enterprise-plan-blurb.astro';
import Aside from 'src/components/Aside.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Learn how to complete a Two Factor authentication for a User.
section: customize
subcategory: email and messages
tertcategory: deprecated
topOfNav: true
navOrder: 0
---
import InlineField from 'src/components/InlineField.astro';
import Aside from 'src/components/Aside.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Email & Messages Overview
description: An overview of the FusionAuth Email Template system.
section: customize
subcategory: email and messages
topOfNav: true
navOrder: 0
---
import InlineField from 'src/components/InlineField.astro';
import EmailTroubleshooting from 'src/content/docs/customize/email-and-messages/_email-troubleshooting.mdx';
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/customize/look-and-feel/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Themes Overview
description: Learn about theming the FusionAuth hosted login pages.
section: customize
subcategory: look and feel
topOfNav: true
navOrder: 0
tags: auth as a service
---
import ListHostedLoginPagesUseCases from 'src/content/docs/_shared/_list-hosted-login-pages-use-cases.mdx';
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/extend/code/lambdas/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: An overview of FusionAuth's lambdas, which are pluggable JavaScript
section: extend
subcategory: code
tertcategory: lambdas
topOfNav: true
navOrder: 0
---
import AdvancedPlanBlurb from 'src/content/docs/_shared/_advanced-plan-blurb.astro';
import Aside from 'src/components/Aside.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: An overview of how to make API calls from Lambdas.
section: extend
subcategory: code
tertcategory: lambdas
topOfNav: true
navOrder: 10
---
import AdvancedPlanBlurb from 'src/content/docs/_shared/_advanced-plan-blurb.astro';
import APIBlock from 'src/components/api/APIBlock.astro';
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/extend/code/lambdas/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A guide on how to create and test lambdas with FusionAuth.
section: extend
subcategory: code
tertcategory: lambdas
topOfNav: true
navOrder: 20
---
import { RemoteCode } from '@fusionauth/astro-components';
import Aside from 'src/components/Aside.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Extend the functionality of FusionAuth with plugins.
section: extend
subcategory: code
tertcategory: password hashes
topOfNav: true
navOrder: 0
---
import InlineField from 'src/components/InlineField.astro';
import InlineUIElement from 'src/components/InlineUIElement.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navcategory: developer
section: extend
subcategory: events and webhooks
tertcategory: events
topOfNav: true
navOrder: 0
---
import PremiumPlanBlurb from 'src/content/docs/_shared/_premium-plan-blurb.astro';
import EnterprisePlanBlurb from 'src/content/docs/_shared/_enterprise-plan-blurb.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: An overview of the FusionAuth Event and Webhook system.
navcategory: developer
section: extend
subcategory: events and webhooks
topOfNav: true
navOrder: 0
---
import APIBlock from 'src/components/api/APIBlock.astro';
import APIDeprecatedRemoved from 'src/content/docs/_shared/_api-deprecated-removed.mdx';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navcategory: developer
section: extend
subcategory: examples
tertcategory: api gateways
topOfNav: true
navOrder: 0
---
import ApiGatewayArchitectureDiagram from 'src/diagrams/docs/extend/examples/api-gateways/_example-api-gateway-architecture.astro';
import InlineField from 'src/components/InlineField.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Learn how to install FusionAuth using cloud marketplaces such as AW
section: get started
subcategory: run in the cloud
tertcategory: marketplaces
topOfNav: true
navOrder: 0
---
import PaidFeatures from 'src/content/docs/get-started/run-in-the-cloud/marketplaces/_paid-features.mdx';

Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/get-started/use-cases/index.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Use Cases Overview
topOfNav: true
description: An overview of common FusionAuth Use Cases.
section: get started
subcategory: use cases
navOrder: 0
---
import AuthServiceDescription from 'src/content/docs/get-started/use-cases/_auth-service-description.mdx';
import AppSuiteDescription from 'src/content/docs/get-started/use-cases/_app-suite-description.mdx';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navcategory: login-methods
section: lifecycle
subcategory: authenticate users
tertcategory: identity providers
topOfNav: true
navOrder: 0
tags: authorization hub
---
import Aside from 'src/components/Aside.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ section: lifecycle
subcategory: authenticate users
tertcategory: integrations
quatercategory: oidc
topOfNav: true
navOrder: 0
---

While OpenID Connect (OIDC) is a standard and is broadly interoperable, this section contains examples of integrations where external applications delegate to FusionAuth for user authentication.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navcategory: developer
section: lifecycle
subcategory: authenticate users
tertcategory: login api
topOfNav: true
navOrder: 0
---
import LoginAPIIssues from 'src/content/docs/get-started/core-concepts/_login-api-issues.mdx';
import LoginAPIScopeLimitations from 'src/content/docs/_shared/_login-api-scope-limits.mdx';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navcategory: login-methods
section: lifecycle
subcategory: authenticate users
tertcategory: oauth
topOfNav: true
navOrder: 0
---
import APIBlock from 'src/components/api/APIBlock.astro';
import APIField from 'src/components/api/APIField.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navcategory: login-methods
section: lifecycle
subcategory: authenticate users
tertcategory: passwordless
topOfNav: true
navOrder: 0
---
import { YouTube } from '@astro-community/astro-embed-youtube';

Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/lifecycle/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Lifecycle Overview
description: An overview of the CIAM lifecycle.
section: lifecycle
topOfNav: true
navOrder: 0
---

There's a lifecycle for CIAM users:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navcategory: premium
section: lifecycle
subcategory: manage users
tertcategory: account management
topOfNav: true
navOrder: 0
---
import PremiumPlanBlurb from 'src/content/docs/_shared/_premium-plan-blurb.astro';
import Aside from 'src/components/Aside.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navcategory: premium
section: lifecycle
subcategory: migrate users
tertcategory: connectors
topOfNav: true
navOrder: 0
---
import Aside from 'src/components/Aside.astro';
import ConnectorDiagram from 'src/diagrams/docs/lifecycle/migrate-users/connectors/_connector-diagram.astro';
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/lifecycle/migrate-users/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: User Data Migration
description: Learn how can you move users to FusionAuth.
section: lifecycle
subcategory: migrate users
topOfNav: true
navOrder: 0
---
import PremiumPlanBlurb from 'src/content/docs/_shared/_premium-plan-blurb.astro';
import EnterprisePlanBlurb from 'src/content/docs/_shared/_enterprise-plan-blurb.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navcategory: premium
section: lifecycle
subcategory: migrate users
tertcategory: scim
topOfNav: true
navOrder: 0
---
import EnterprisePlanBlurb from 'src/content/docs/_shared/_enterprise-plan-blurb.astro';
import Aside from 'src/components/Aside.astro';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Overview
description: Learn about FusionAuth's registration options.
section: lifecycle
subcategory: register users
topOfNav: true
navOrder: 0
---

Registration lets you control which users have access to which applications in a tenant (authorization), in contrast to authenticating a user. [Learn more about these concepts.](/docs/get-started/core-concepts/authentication-authorization)
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/release-notes/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Release Notes
description: This page contains release notes for recent versions of FusionAuth.
section: release notes
disableTOC: true
topOfNav: true
navOrder: 0
---
import Breadcrumb from 'src/components/Breadcrumb.astro';
import DatabaseMigrationWarning from 'src/components/docs/release-notes/DatabaseMigrationWarning.mdx';
Expand Down
2 changes: 1 addition & 1 deletion astro/src/content/docs/sdks/examples/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Learn about example applications using FusionAuth.
section: sdks
subcategory: examples
disableTOC: true
topOfNav: true
navOrder: 0
canonicalUrl: /docs/extend/examples/example-repos
---
import ExampleAppsIntro from 'src/content/docs/sdks/examples/_example_apps_intro.mdx';
Expand Down
4 changes: 2 additions & 2 deletions astro/src/tools/docs/DocNavContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface DocNavEntry {
title: string;
href: string;
description?: string;
topOfNav?: boolean;
navOrder?: number;
}
export interface DocNavContext {
category: Category;
Expand All @@ -13,4 +13,4 @@ export interface Category {
href: string;
entries: DocNavEntry[];
subcategories: Category[];
}
}
19 changes: 9 additions & 10 deletions astro/src/tools/docs/getDocNavContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ const prepContext = (context: DocNavContext, subcategory: string, tertcategory:

const recursiveSort = (category: Category) => {
if (category.entries.length > 0) {
category.entries.sort((a, b) => a.title.localeCompare(b.title));
const topOfNavElements = category.entries.filter(entry => entry.topOfNav);

// sort these in reverse order so we process the Z elements before the A elements, which means A elements come first
topOfNavElements.sort((a, b) => b.title.localeCompare(a.title));
topOfNavElements.map((top) => {
const idx = category.entries.indexOf(top);
category.entries.splice(idx, 1);
category.entries.unshift(top);
category.entries.sort((a, b) => {
// everything has a default of 1000, so sorts to bottom
const numCompare = a.navOrder - b.navOrder;
if (numCompare !== 0) {
return numCompare;
}
return a.title.localeCompare(b.title);
});
}
if (category.subcategories.length > 0) {
Expand All @@ -84,13 +83,13 @@ export const getDocNavContext = async (section: string) => {

const sectionDocs = await getCollection('docs', doc => doc.data.section === section);
sectionDocs.forEach(doc => {
const { subcategory, tertcategory, quatercategory, title, description, topOfNav } = doc.data;
const { subcategory, tertcategory, quatercategory, title, description, navOrder } = doc.data;
const category = prepContext(context, subcategory, tertcategory, quatercategory);
category.entries.push({
title,
description,
href: getDocHref(doc.slug),
topOfNav,
navOrder,
})
});
recursiveSort(context.category);
Expand Down