Skip to content

Commit 7144b12

Browse files
authored
Merge pull request #654 from github/combine-llms-txt-generation
Use absolute URLs in llms.txt
2 parents 9a2dbf2 + 1a9b280 commit 7144b12

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

website/src/pages/llms.txt.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ import promptsData from "../../public/data/prompts.json";
44
import instructionsData from "../../public/data/instructions.json";
55
import skillsData from "../../public/data/skills.json";
66

7+
// Base URL for absolute links (to raw GitHub content)
8+
const GITHUB_RAW_BASE = "https://raw.githubusercontent.com/github/awesome-copilot/main";
9+
710
export const GET: APIRoute = () => {
811
const agents = agentsData.items;
912
const prompts = promptsData.items;
1013
const instructions = instructionsData.items;
1114
const skills = skillsData.items;
15+
16+
const url = (path: string) => `${GITHUB_RAW_BASE}/${path}`;
1217

1318
let content = "";
1419

@@ -38,7 +43,7 @@ export const GET: APIRoute = () => {
3843
const description = (agent.description || "No description available")
3944
.replace(/\s+/g, " ")
4045
.trim();
41-
content += `- [${agent.title}](${agent.path}): ${description}\n`;
46+
content += `- [${agent.title}](${url(agent.path)}): ${description}\n`;
4247
}
4348
content += "\n";
4449

@@ -48,7 +53,7 @@ export const GET: APIRoute = () => {
4853
const description = (prompt.description || "No description available")
4954
.replace(/\s+/g, " ")
5055
.trim();
51-
content += `- [${prompt.title}](${prompt.path}): ${description}\n`;
56+
content += `- [${prompt.title}](${url(prompt.path)}): ${description}\n`;
5257
}
5358
content += "\n";
5459

@@ -58,7 +63,7 @@ export const GET: APIRoute = () => {
5863
const description = (instruction.description || "No description available")
5964
.replace(/\s+/g, " ")
6065
.trim();
61-
content += `- [${instruction.title}](${instruction.path}): ${description}\n`;
66+
content += `- [${instruction.title}](${url(instruction.path)}): ${description}\n`;
6267
}
6368
content += "\n";
6469

@@ -68,21 +73,21 @@ export const GET: APIRoute = () => {
6873
const description = (skill.description || "No description available")
6974
.replace(/\s+/g, " ")
7075
.trim();
71-
content += `- [${skill.title}](${skill.skillFile}): ${description}\n`;
76+
content += `- [${skill.title}](${url(skill.skillFile)}): ${description}\n`;
7277
}
7378
content += "\n";
7479

7580
// Add documentation links
7681
content += "## Documentation\n\n";
7782
content +=
78-
"- [README.md](README.md): Main documentation and getting started guide\n";
83+
`- [README.md](${url("README.md")}): Main documentation and getting started guide\n`;
7984
content +=
80-
"- [CONTRIBUTING.md](CONTRIBUTING.md): Guidelines for contributing to this repository\n";
85+
`- [CONTRIBUTING.md](${url("CONTRIBUTING.md")}): Guidelines for contributing to this repository\n`;
8186
content +=
82-
"- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md): Community standards and expectations\n";
83-
content += "- [SECURITY.md](SECURITY.md): Security policies and reporting\n";
87+
`- [CODE_OF_CONDUCT.md](${url("CODE_OF_CONDUCT.md")}): Community standards and expectations\n`;
88+
content += `- [SECURITY.md](${url("SECURITY.md")}): Security policies and reporting\n`;
8489
content +=
85-
"- [AGENTS.md](AGENTS.md): Project overview and setup commands\n\n";
90+
`- [AGENTS.md](${url("AGENTS.md")}): Project overview and setup commands\n\n`;
8691

8792
// Add repository information
8893
content += "## Repository\n\n";

0 commit comments

Comments
 (0)