docs: add support for keywords in references (#12413)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { MDXRemote } from "next-mdx-remote/rsc"
|
||||
import { MDXRemote, MDXRemoteSerializeResult } from "next-mdx-remote/rsc"
|
||||
import { serialize } from "next-mdx-remote/serialize"
|
||||
import path from "path"
|
||||
import { promises as fs } from "fs"
|
||||
import { notFound } from "next/navigation"
|
||||
@@ -93,6 +94,7 @@ export async function generateMetadata({
|
||||
}
|
||||
|
||||
metadata.title = pageTitleMatch.groups.title
|
||||
metadata.keywords = (fileData.source.frontmatter?.keywords || []) as string[]
|
||||
|
||||
return metadata
|
||||
}
|
||||
@@ -103,6 +105,7 @@ const loadFile = cache(
|
||||
): Promise<
|
||||
| {
|
||||
content: string
|
||||
source: MDXRemoteSerializeResult
|
||||
path: string
|
||||
}
|
||||
| undefined
|
||||
@@ -120,8 +123,14 @@ const loadFile = cache(
|
||||
return undefined
|
||||
}
|
||||
const fullPath = path.join(monoRepoPath, fileDetails.filePath)
|
||||
|
||||
const fileContent = await fs.readFile(fullPath, "utf-8")
|
||||
const serialized = await serialize(fileContent, {
|
||||
parseFrontmatter: true,
|
||||
})
|
||||
return {
|
||||
content: await fs.readFile(fullPath, "utf-8"),
|
||||
content: fileContent,
|
||||
source: serialized,
|
||||
path: fullPath,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,10 @@ tags:
|
||||
- server
|
||||
- how to
|
||||
sidebar_label: Create Auth Provider
|
||||
keywords:
|
||||
- auth
|
||||
- provider
|
||||
- integration
|
||||
---
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
@@ -521,7 +525,7 @@ module.exports = defineConfig({
|
||||
|
||||
## 5. Test it Out
|
||||
|
||||
To test out your Authentication Module Provider, use any of the [Authentication Routes](https://docs.medusajs.com/v2/resources/commerce-modules/auth/authentication-route), using your provider's ID as a path parameter.
|
||||
To test out your Authentication Module Provider, use any of the [Authentication Routes](https://docs.medusajs.com/resources/commerce-modules/auth/authentication-route), using your provider's ID as a path parameter.
|
||||
|
||||
For example, to get a registration token for an admin user, send a `POST` request to `/auth/user/my-auth/register` replacing `my-auth` with your Authentication Module Provider's ID:
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@ tags:
|
||||
- server
|
||||
- how to
|
||||
sidebar_label: Use Cache Module
|
||||
keywords:
|
||||
- cache
|
||||
- provider
|
||||
- integration
|
||||
---
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
|
||||
@@ -5,6 +5,10 @@ tags:
|
||||
- server
|
||||
- how to
|
||||
sidebar_label: Use Event Module
|
||||
keywords:
|
||||
- event
|
||||
- provider
|
||||
- integration
|
||||
---
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
---
|
||||
slug: /references/file-provider-module
|
||||
keywords:
|
||||
- file
|
||||
- storage
|
||||
- provider
|
||||
- integration
|
||||
---
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
|
||||
@@ -5,6 +5,10 @@ tags:
|
||||
- server
|
||||
- how to
|
||||
sidebar_label: Create Locking Provider
|
||||
keywords:
|
||||
- locking
|
||||
- provider
|
||||
- integration
|
||||
---
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
|
||||
@@ -5,6 +5,10 @@ tags:
|
||||
- server
|
||||
- how to
|
||||
sidebar_label: Use Notification Module
|
||||
keywords:
|
||||
- notification
|
||||
- provider
|
||||
- integration
|
||||
---
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
|
||||
@@ -5,6 +5,10 @@ tags:
|
||||
- server
|
||||
- how to
|
||||
sidebar_label: Create Tax Provider
|
||||
keywords:
|
||||
- tax
|
||||
- provider
|
||||
- integration
|
||||
---
|
||||
|
||||
import { TypeList } from "docs-ui"
|
||||
|
||||
@@ -11,6 +11,7 @@ const authProviderOptions: FormattingOptionsType = {
|
||||
slug: "/references/auth/provider",
|
||||
tags: ["auth", "server", "how to"],
|
||||
sidebar_label: "Create Auth Provider",
|
||||
keywords: ["auth", "provider", "integration"],
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create an Auth Module Provider",
|
||||
|
||||
@@ -10,6 +10,7 @@ const cacheOptions: FormattingOptionsType = {
|
||||
slug: "/references/cache-service",
|
||||
tags: ["cache", "server", "how to"],
|
||||
sidebar_label: "Use Cache Module",
|
||||
keywords: ["cache", "provider", "integration"],
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Use Cache Module",
|
||||
|
||||
@@ -10,6 +10,7 @@ const eventOptions: FormattingOptionsType = {
|
||||
slug: "/references/event-service",
|
||||
tags: ["event", "server", "how to"],
|
||||
sidebar_label: "Use Event Module",
|
||||
keywords: ["event", "provider", "integration"],
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Use Event Module",
|
||||
|
||||
@@ -9,6 +9,7 @@ const fileOptions: FormattingOptionsType = {
|
||||
reflectionDescription: `In this document, you’ll learn how to create a File Module Provider and the methods you must implement in its main service.`,
|
||||
frontmatterData: {
|
||||
slug: "/references/file-provider-module",
|
||||
keywords: ["file", "storage", "provider", "integration"],
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create a File Module Provider",
|
||||
|
||||
@@ -11,6 +11,7 @@ const fulfillmentProviderOptions: FormattingOptionsType = {
|
||||
slug: "/references/fulfillment/provider",
|
||||
tags: ["fulfillment", "server", "how to"],
|
||||
sidebar_label: "Create Fulfillment Provider",
|
||||
keywords: ["fulfillment", "shipping", "provider", "integration"],
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create a Fulfillment Module Provider",
|
||||
|
||||
@@ -11,6 +11,7 @@ const lockingOptions: FormattingOptionsType = {
|
||||
slug: "/references/locking-module-provider",
|
||||
tags: ["locking", "server", "how to"],
|
||||
sidebar_label: "Create Locking Provider",
|
||||
keywords: ["locking", "provider", "integration"],
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create a Locking Module Provider",
|
||||
|
||||
@@ -10,6 +10,7 @@ const notificationServiceOptions: FormattingOptionsType = {
|
||||
slug: "/references/notification-service",
|
||||
tags: ["notification", "server", "how to"],
|
||||
sidebar_label: "Use Notification Module",
|
||||
keywords: ["notification", "provider", "integration"],
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Use Notification Module",
|
||||
|
||||
@@ -11,6 +11,7 @@ const paymentProviderOptions: FormattingOptionsType = {
|
||||
slug: "/references/payment/provider",
|
||||
tags: ["payment", "server", "how to"],
|
||||
sidebar_label: "Create Payment Provider",
|
||||
keywords: ["payment", "provider", "integration"],
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create a Payment Module Provider",
|
||||
|
||||
@@ -10,6 +10,7 @@ const taxProviderOptions: FormattingOptionsType = {
|
||||
slug: "/references/tax/provider",
|
||||
tags: ["tax", "server", "how to"],
|
||||
sidebar_label: "Create Tax Provider",
|
||||
keywords: ["tax", "provider", "integration"],
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create a Tax Module Provider",
|
||||
|
||||
1
www/utils/packages/types/lib/index.d.ts
vendored
1
www/utils/packages/types/lib/index.d.ts
vendored
@@ -62,6 +62,7 @@ export type FrontmatterData = {
|
||||
sidebar_label?: string
|
||||
displayed_sidebar?: string
|
||||
tags?: Tag[]
|
||||
keywords?: string[]
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user