feat(docs): fix build issues, add external links

This commit is contained in:
rzmk 2025-12-02 20:30:37 -05:00
parent 0fdbdd4d1c
commit 100165ec29
5 changed files with 52 additions and 11 deletions

View file

@ -1,19 +1,42 @@
import Link from 'next/link'; import Link from "next/link";
export default function HomePage() { export default function HomePage() {
return ( return (
<main className="flex flex-1 flex-col justify-center text-center"> <main className="flex flex-1 flex-col justify-center text-center">
<h1 className="mb-4 text-2xl font-bold">ckanaction</h1> <h1 className="mb-4 text-2xl font-bold">ckanaction</h1>
<p className="text-fd-muted-foreground"> <p className="text-fd-muted-foreground">
You can open{' '} You can open{" "}
<Link <Link
href="/docs" href="/docs"
className="text-fd-foreground font-semibold underline" className="text-fd-foreground font-semibold underline"
> >
/docs /docs
</Link>{' '} </Link>{" "}
and see the interactive documentation. and see the interactive documentation.
</p> </p>
<footer className="absolute bottom-2 ml-4 flex flex-col bg-brand-secondary text-brand-secondary-foreground rounded-2xl">
<p className="text-xs">
Provided by{" "}
<a
href="https://dathere.com"
target="_blank"
className="font-medium text-blue-400"
rel="noopener"
>
datHere
</a>
.{" "}
<a
href="https://dathere.com/privacy-policy/"
target="_blank"
className="font-medium text-blue-400"
rel="noopener"
>
Privacy Policy
</a>
.
</p>
</footer>
</main> </main>
); );
} }

View file

@ -1,23 +1,25 @@
import { getPageImage, source } from '@/lib/source'; import { createRelativeLink } from "fumadocs-ui/mdx";
import { import {
DocsBody, DocsBody,
DocsDescription, DocsDescription,
DocsPage, DocsPage,
DocsTitle, DocsTitle,
} from 'fumadocs-ui/page'; } from "fumadocs-ui/page";
import { notFound } from 'next/navigation'; import type { Metadata } from "next";
import { getMDXComponents } from '@/mdx-components'; import { notFound } from "next/navigation";
import type { Metadata } from 'next'; import { getPageImage, source } from "@/lib/source";
import { createRelativeLink } from 'fumadocs-ui/mdx'; import { getMDXComponents } from "@/mdx-components";
export default async function Page(props: PageProps<'/docs/[[...slug]]'>) { export default async function Page(props: PageProps<"/docs/[[...slug]]">) {
const params = await props.params; const params = await props.params;
const page = source.getPage(params.slug); const page = source.getPage(params.slug);
if (!page) notFound(); if (!page) notFound();
// @ts-expect-error
const MDX = page.data.body; const MDX = page.data.body;
return ( return (
// @ts-expect-error
<DocsPage toc={page.data.toc} full={page.data.full}> <DocsPage toc={page.data.toc} full={page.data.full}>
<DocsTitle>{page.data.title}</DocsTitle> <DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription>{page.data.description}</DocsDescription> <DocsDescription>{page.data.description}</DocsDescription>
@ -38,7 +40,7 @@ export async function generateStaticParams() {
} }
export async function generateMetadata( export async function generateMetadata(
props: PageProps<'/docs/[[...slug]]'>, props: PageProps<"/docs/[[...slug]]">,
): Promise<Metadata> { ): Promise<Metadata> {
const params = await props.params; const params = await props.params;
const page = source.getPage(params.slug); const page = source.getPage(params.slug);

View file

@ -37,4 +37,6 @@ The source code of ckanaction can be found at [github.com/dathere/ckanaction](ht
You may also explore this web app to view more code examples for each endpoint and also use an interactive GUI for sending HTTP requests to any local or remote CKAN instance. You may also explore this web app to view more code examples for each endpoint and also use an interactive GUI for sending HTTP requests to any local or remote CKAN instance.
View the GIF below to see how to point to a specific CKAN API endpoint using the interactive GUI, which by default points to a local CKAN instance endpoint's URL.
![ckanaction web app demo](/ckanaction-web-app-interactive-demo.gif) ![ckanaction web app demo](/ckanaction-web-app-interactive-demo.gif)

View file

@ -0,0 +1,12 @@
{
"pages": [
"--- ---",
"index",
"---🎁 Interactive CKAN API GUI---",
"...",
"--- ---",
"[Source Code](https://github.com/dathere/ckanaction)",
"[Support and Feedback](https://support.dathere.com)",
"[Privacy Policy](https://dathere.com/privacy-policy/)"
]
}

View file

@ -7,6 +7,7 @@ import { docs } from "@/.source";
export const source = loader({ export const source = loader({
baseUrl: "/docs", baseUrl: "/docs",
source: docs.toFumadocsSource(), source: docs.toFumadocsSource(),
// @ts-expect-error
plugins: [lucideIconsPlugin(), openapiPlugin()], plugins: [lucideIconsPlugin(), openapiPlugin()],
}); });
@ -20,6 +21,7 @@ export function getPageImage(page: InferPageType<typeof source>) {
} }
export async function getLLMText(page: InferPageType<typeof source>) { export async function getLLMText(page: InferPageType<typeof source>) {
// @ts-expect-error
const processed = await page.data.getText("processed"); const processed = await page.data.getText("processed");
return `# ${page.data.title} (${page.url}) return `# ${page.data.title} (${page.url})