generate metadata for the documentation page
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m10s
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m10s
This commit is contained in:
parent
e8e74a1a8d
commit
57a45a4c05
@ -1,4 +1,4 @@
|
|||||||
import createMDX from '@next/mdx'
|
import createMDX from "@next/mdx";
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
import { getDocumentation } from "@/common/documentation";
|
import { getDocumentation } from "@/common/documentation";
|
||||||
import { CustomMDX } from "@/app/components/mx-components";
|
import { CustomMDX } from "@/app/components/mx-components";
|
||||||
|
import { Metadata } from "next";
|
||||||
|
import { generateEmbed } from "@/common/embed";
|
||||||
|
|
||||||
|
type DocumentationPageParams = {
|
||||||
|
params: {
|
||||||
|
slug?: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
let documentationPages = getDocumentation();
|
let documentationPages = getDocumentation();
|
||||||
@ -9,11 +17,22 @@ export async function generateStaticParams() {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
type DocumentationPageParams = {
|
export async function generateMetadata({ params: { slug } }: DocumentationPageParams): Promise<Metadata> {
|
||||||
params: {
|
const documentationPages = getDocumentation();
|
||||||
slug?: string;
|
let page = documentationPages.find(page => page.slug === slug);
|
||||||
};
|
|
||||||
};
|
if (!page) {
|
||||||
|
return generateEmbed({
|
||||||
|
title: "Page not found",
|
||||||
|
description: "The documentation page was not found",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return generateEmbed({
|
||||||
|
title: page.metadata.title,
|
||||||
|
description: "Click to view this page",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export default function Page({ params: { slug } }: DocumentationPageParams) {
|
export default function Page({ params: { slug } }: DocumentationPageParams) {
|
||||||
const documentationPages = getDocumentation();
|
const documentationPages = getDocumentation();
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { ReactElement } from "react";
|
import { ReactElement } from "react";
|
||||||
import config from "@root/config.json";
|
|
||||||
|
|
||||||
type LogoProps = {
|
type LogoProps = {
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user