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: 10 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ const nextConfig: NextConfig = {
destination: "/testimonials",
permanent: true,
},
/**
* /llms-full.txt used to serve the whole site as one document. It is now
* covered by /llms.txt plus the per-section .md routes, so agents probing
* the conventional URL land on the index instead of a 404.
*/
{
source: "/llms-full.txt",
destination: "/llms.txt",
permanent: true,
},
{
source: "/blocks/content",
destination: "/blocks/marketing",
Expand Down
34 changes: 34 additions & 0 deletions src/app/(llms)/blog.md/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { format } from "date-fns"

import { SITE_INFO } from "@/config/site"
import { getBlogPosts } from "@/features/doc/data/documents"

const allPosts = getBlogPosts()
.slice()
.sort(
(a, b) =>
new Date(b.metadata.createdAt).getTime() -
new Date(a.metadata.createdAt).getTime()
)

const content = `# Blog

> Writing about code, design, and everything in between.

Each link below returns the full post as Markdown. Drop the \`.mdx\` extension for the web page.

## All posts (${allPosts.length})

${allPosts.map((item) => `- [${item.metadata.title}](${SITE_INFO.url}/blog/${item.slug}.mdx) (${format(new Date(item.metadata.createdAt), "yyyy-MM-dd")}): ${item.metadata.description}`).join("\n")}
`

export const revalidate = false
export const dynamic = "force-static"

export async function GET() {
return new Response(content, {
headers: {
"Content-Type": "text/markdown;charset=utf-8",
},
})
}
46 changes: 46 additions & 0 deletions src/app/(llms)/bookmarks.md/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { compareDesc, format } from "date-fns"

import { SITE_INFO } from "@/config/site"
import { BOOKMARKS } from "@/features/portfolio/data/bookmarks"
import { BookmarkCategory } from "@/features/portfolio/types/bookmarks"

const categorySections = Object.values(BookmarkCategory)
.map((category) => {
const items = BOOKMARKS.filter((item) => item.category === category).sort(
(a, b) => compareDesc(new Date(a.bookmarkedAt), new Date(b.bookmarkedAt))
)

return { category, items }
})
.filter(({ items }) => items.length > 0)

const content = `# Bookmarks

> Articles, courses, books, references, and tools I keep coming back to.

${BOOKMARKS.length} bookmarks in total, grouped by category and newest first. They are also listed on ${SITE_INFO.url}/#bookmarks.

${categorySections
.map(
({ category, items }) => `## ${category} (${items.length})

${items
.map(
(item) =>
`- [${item.title}](${item.url})${item.author ? ` by ${item.author}` : ""} (${format(new Date(item.bookmarkedAt), "yyyy-MM-dd")})`
)
.join("\n")}`
)
.join("\n\n")}
`

export const revalidate = false
export const dynamic = "force-static"

export async function GET() {
return new Response(content, {
headers: {
"Content-Type": "text/markdown;charset=utf-8",
},
})
}
26 changes: 26 additions & 0 deletions src/app/(llms)/education.md/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { EDUCATION } from "@/features/portfolio/data/education"

const content = `# Education

${EDUCATION.map((item) => {
const heading =
[item.degree, item.fieldOfStudy].filter(Boolean).join(", ") || item.school
const school = heading === item.school ? "" : ` | ${item.school}`
const skills = item.skills?.length
? `\n\nSkills: ${item.skills.join(", ")}`
: ""
const description = item.description ? `\n\n${item.description.trim()}` : ""
return `## ${heading}${school}\n\nDuration: ${item.period.start} - ${item.period.end || "Present"}${skills}${description}`
}).join("\n\n")}
`

export const revalidate = false
export const dynamic = "force-static"

export async function GET() {
return new Response(content, {
headers: {
"Content-Type": "text/markdown;charset=utf-8",
},
})
}
103 changes: 0 additions & 103 deletions src/app/(llms)/llms-full.txt/route.ts

This file was deleted.

5 changes: 5 additions & 0 deletions src/app/(llms)/llms.txt/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ const content = `# chanhdai.com

- [About](${SITE_INFO.url}/about.md): A quick intro to me, my tech stack, and how to connect.
- [Experience](${SITE_INFO.url}/experience.md): Highlights from my career and key roles I've taken on.
- [Education](${SITE_INFO.url}/education.md): Where I studied, what I focused on, and what I built along the way.
- [Projects](${SITE_INFO.url}/projects.md): Selected projects that show my skills and creativity.
- [Awards](${SITE_INFO.url}/awards.md): My key awards and honors.
- [Certifications](${SITE_INFO.url}/certifications.md): Certifications and credentials I've earned.
- [Components](${SITE_INFO.url}/components.md): Every registry component, with install instructions.
- [Blocks](${SITE_INFO.url}/blocks.md): Every registry block, grouped by category, with install instructions.
- [Blog](${SITE_INFO.url}/blog.md): Every blog post, newest first, with publish dates.
- [Bookmarks](${SITE_INFO.url}/bookmarks.md): Articles, courses, books, references, and tools I recommend.

## Components

Expand Down