Skip to content
Open
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
11 changes: 11 additions & 0 deletions .claude/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.0.1",
"configurations": [
{
"name": "website-dev",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "dev"],
"port": 3000
}
]
}
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"next-sitemap": "^4.2.3",
"payload": "3.76.1",
"payload-exif": "^1.1.1",
"payload-plugin-llms-txt": "^0.2.0",
"prism-react-renderer": "^2.3.1",
"react": "19.2.1",
"react-dom": "19.2.1",
Expand Down
23 changes: 23 additions & 0 deletions src/app/(frontend)/llms-full.txt/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { unstable_cache } from 'next/cache'
import config from '@payload-config'
import { createLlmsFullTxtRouteHandler } from 'payload-plugin-llms-txt/next'
import { llmsTxtOptions } from '@/plugins/llmsTxt'

const handler = createLlmsFullTxtRouteHandler(config, llmsTxtOptions)

const getLlmsFullTxt = unstable_cache(
async () => {
const response = await handler()
return response.text()
},
['llms-full-txt'],
{
tags: ['llms-full-txt'],
},
)

export async function GET() {
const text = await getLlmsFullTxt()

return new Response(text, { headers: { 'Content-Type': 'text/plain; charset=utf-8' } })
}
23 changes: 23 additions & 0 deletions src/app/(frontend)/llms.txt/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { unstable_cache } from 'next/cache'
import config from '@payload-config'
import { createLlmsTxtRouteHandler } from 'payload-plugin-llms-txt/next'
import { llmsTxtOptions } from '@/plugins/llmsTxt'

const handler = createLlmsTxtRouteHandler(config, llmsTxtOptions)

const getLlmsTxt = unstable_cache(
async () => {
const response = await handler()
return response.text()
},
['llms-txt'],
{
tags: ['llms-txt'],
},
)

export async function GET() {
const text = await getLlmsTxt()

return new Response(text, { headers: { 'Content-Type': 'text/plain; charset=utf-8' } })
}
29 changes: 29 additions & 0 deletions src/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ export interface Config {
header: Header;
footer: Footer;
site: Site;
'llms-txt-settings': LlmsTxtSetting;
};
globalsSelect: {
header: HeaderSelect<false> | HeaderSelect<true>;
footer: FooterSelect<false> | FooterSelect<true>;
site: SiteSelect<false> | SiteSelect<true>;
'llms-txt-settings': LlmsTxtSettingsSelect<false> | LlmsTxtSettingsSelect<true>;
};
locale: null;
user: User;
Expand Down Expand Up @@ -2385,6 +2387,22 @@ export interface Site {
updatedAt?: string | null;
createdAt?: string | null;
}
/**
* Controls the content of /llms.txt and /llms-full.txt.
*
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "llms-txt-settings".
*/
export interface LlmsTxtSetting {
id: string;
enabled?: boolean | null;
/**
* Shown at the top of llms.txt instead of the plugin siteDescription option, when set.
*/
introOverride?: string | null;
updatedAt?: string | null;
createdAt?: string | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "header_select".
Expand Down Expand Up @@ -2441,6 +2459,17 @@ export interface SiteSelect<T extends boolean = true> {
createdAt?: T;
globalType?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "llms-txt-settings_select".
*/
export interface LlmsTxtSettingsSelect<T extends boolean = true> {
enabled?: T;
introOverride?: T;
updatedAt?: T;
createdAt?: T;
globalType?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "TaskSchedulePublish".
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import { redirectsPlugin } from '@payloadcms/plugin-redirects'
import { seoPlugin } from '@payloadcms/plugin-seo'
import { searchPlugin } from '@payloadcms/plugin-search'
import { s3Storage } from '@payloadcms/storage-s3'
import { llmsTxtPlugin } from 'payload-plugin-llms-txt'
import { Plugin } from 'payload'
import { revalidateRedirects } from '@/hooks/revalidateRedirects'
import { GenerateTitle, GenerateURL } from '@payloadcms/plugin-seo/types'
import { FixedToolbarFeature, HeadingFeature, lexicalEditor } from '@payloadcms/richtext-lexical'
import { searchFields } from '@/search/fieldOverrides'
import { beforeSyncWithSearch } from '@/search/beforeSync'
import { llmsTxtOptions } from './llmsTxt'

import { Page, Post } from '@/payload-types'
import { getServerSideURL } from '@/utilities/getURL'
Expand Down Expand Up @@ -122,4 +124,5 @@ export const plugins: Plugin[] = [
},
},
}),
llmsTxtPlugin(llmsTxtOptions),
]
31 changes: 31 additions & 0 deletions src/plugins/llmsTxt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { LlmsTxtPluginOptions } from 'payload-plugin-llms-txt'
import { getServerSideURL } from '@/utilities/getURL'

export const llmsTxtOptions: LlmsTxtPluginOptions = {
siteName: 'Logan Kuzyk',
siteDescription:
'Personal website for Logan Kuzyk — projects, blog posts, career history, and photography.',
siteURL: getServerSideURL(),
enableFullText: true,
addSettingsGlobal: true,
collections: [
{
slug: 'posts',
descriptionField: 'meta.description',
contentField: 'content',
urlPath: (doc) => `/posts/${doc.slug}`,
},
{
slug: 'projects',
descriptionField: 'description',
contentField: 'content',
urlPath: (doc) => `/projects/${doc.slug}`,
},
{
slug: 'pages',
descriptionField: 'meta.description',
label: 'Pages',
urlPath: (doc) => (doc.slug === 'home' ? '/' : `/${doc.slug}`),
},
],
}
Loading