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
10 changes: 5 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const metadata = {
}
```

3. Add navigation entry in `/src/components/Navigation.jsx`
3. Add navigation entry in `/src/lib/navigation.ts`

### MDX Page Structure

Expand Down Expand Up @@ -124,7 +124,7 @@ Store in `/public/images/` and reference as:

### Navigation

Navigation structure is defined in `/src/components/Navigation.jsx`. Each section contains an array of pages with `title` and `href`.
Navigation structure is defined in `/src/lib/navigation.ts` and rendered by `/src/components/Navigation.tsx`. Each section contains an array of pages with `title` and `href`.

### Search Index

Expand Down Expand Up @@ -160,7 +160,7 @@ The documentation site uses a sophisticated MDX processing pipeline:

The navigation is centrally managed through several interconnected components:

1. **Navigation Data**: Defined in `/src/components/Navigation.jsx` as a static structure
1. **Navigation Data**: Defined in `/src/lib/navigation.ts` as a static structure, shared by the sidebar, search, footer and the Markdown/llms.txt routes
2. **Dynamic Sections**: The `layout.jsx` file extracts sections from all MDX files at build time
3. **Section Provider**: Uses Zustand to manage active section state for smooth scrolling
4. **Mobile/Desktop Split**: Separate navigation components for responsive design
Expand All @@ -182,7 +182,7 @@ Documentation follows a hierarchical structure:
2. Use two-column layout with `<Row>` and `<Col>`
3. Document properties with `<Properties>` component
4. Include practical code examples
5. Add to navigation in `/src/components/Navigation.jsx`
5. Add to navigation in `/src/lib/navigation.ts`

### Updating Existing Documentation

Expand All @@ -206,5 +206,5 @@ Documentation follows a hierarchical structure:
- Keep code examples practical and directly runnable in Inkdrop
- The site is deployed at https://developers.inkdrop.app/
- All MDX files are automatically indexed for search during the build process
- Navigation is centrally managed in `/src/components/Navigation.jsx`
- Navigation is centrally managed in `/src/lib/navigation.ts`

7 changes: 7 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ const nextConfig = {
outputFileTracingRoot: __dirname,
outputFileTracingIncludes: {
'/**/*': ['./src/app/**/*.mdx']
},
// Serve a plain Markdown version of every page at `<path>.md` for agents
async rewrites() {
return [
{ source: '/index.md', destination: '/raw-md' },
{ source: '/:path+.md', destination: '/raw-md/:path+' }
]
}
}

Expand Down
59 changes: 0 additions & 59 deletions src/app/api/markdown/route.ts

This file was deleted.

9 changes: 9 additions & 0 deletions src/app/llms-full.txt/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getLlmsFullTxt } from '@/lib/markdown'

export const dynamic = 'force-static'

export async function GET() {
return new Response(await getLlmsFullTxt(), {
headers: { 'Content-Type': 'text/plain; charset=utf-8' }
})
}
9 changes: 9 additions & 0 deletions src/app/llms.txt/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getLlmsTxt } from '@/lib/markdown'

export const dynamic = 'force-static'

export async function GET() {
return new Response(await getLlmsTxt(), {
headers: { 'Content-Type': 'text/plain; charset=utf-8' }
})
}
23 changes: 23 additions & 0 deletions src/app/raw-md/[[...slug]]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { getMarkdownSlugs, getPageMarkdown } from '@/lib/markdown'

// Serves each docs page as plain Markdown, e.g. `/states/db.md`.
// Requests are rewritten here from `*.md` URLs in next.config.mjs.
export const dynamic = 'force-static'
export const dynamicParams = false

export async function generateStaticParams() {
let slugs = await getMarkdownSlugs()
return slugs.map(slug => ({ slug }))
}

export async function GET(
_request: Request,
{ params }: { params: Promise<{ slug?: Array<string> }> }
) {
let { slug = [] } = await params
let markdown = await getPageMarkdown(slug)

return new Response(markdown, {
headers: { 'Content-Type': 'text/markdown; charset=utf-8' }
})
}
78 changes: 0 additions & 78 deletions src/components/CopyMarkdownButton.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Link from 'next/link'
import { usePathname } from 'next/navigation'

import { Button } from '@/components/Button'
import { navigation } from '@/components/Navigation'
import { navigation } from '@/lib/navigation'

function PageLink({
label,
Expand Down
25 changes: 1 addition & 24 deletions src/components/Guides.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
import { Button } from '@/components/Button'
import { Heading } from '@/components/Heading'

const guides = [
{
href: '/guides/create-a-theme',
name: 'Create a theme',
description: 'A tutorial on how to create a theme.'
},
{
href: '/guides/plugin-word-count',
name: 'Create a plugin',
description: 'A tutorial on how to create a plugin.'
},
{
href: '/guides/access-the-local-database',
name: 'Access the local database',
description:
'Learn how to access the local database from plugins and external programs.'
},
{
href: '/guides/create-a-blog-using-astro',
name: 'Create a blog using Astro',
description: 'A tutorial on how to create a blog using Astro.'
}
]
import { guides } from '@/lib/guides'

export function Guides() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ListNavigationSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Link from 'next/link'
import { usePathname } from 'next/navigation'

import { navigation } from '@/components/Navigation'
import { navigation } from '@/lib/navigation'

export function ListNavigationSection() {
const currentPath = usePathname()
Expand Down
Loading
Loading