Skip to content

Commit a44fcfc

Browse files
committed
Also add sitemap footer
1 parent af37c5d commit a44fcfc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/pages/api/md/[...path].ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ import type {NextApiRequest, NextApiResponse} from 'next';
99
import fs from 'fs';
1010
import path from 'path';
1111

12+
const FOOTER = `
13+
---
14+
15+
## Sitemap
16+
17+
[Overview of all docs pages](/llms.txt)
18+
`;
19+
1220
export default function handler(req: NextApiRequest, res: NextApiResponse) {
1321
const pathSegments = req.query.path;
1422
if (!pathSegments) {
@@ -35,7 +43,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
3543
const content = fs.readFileSync(fullPath, 'utf8');
3644
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
3745
res.setHeader('Cache-Control', 'public, max-age=3600');
38-
return res.status(200).send(content);
46+
return res.status(200).send(content + FOOTER);
3947
} catch {
4048
// Try next candidate
4149
}

0 commit comments

Comments
 (0)