Skip to content

Commit 9dab326

Browse files
authored
Add LLM-friendly alternate format hints to article pages (#57999)
1 parent ed861c4 commit 9dab326

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/frame/components/DefaultLayout.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,36 @@ export const DefaultLayout = (props: Props) => {
138138
<meta name="twitter:title" content={page.fullTitle} />
139139
{page.introPlainText && <meta name="twitter:description" content={page.introPlainText} />}
140140
<meta name="twitter:image" content={getSocialCardImage()} />
141+
142+
{/* LLM-friendly alternate formats - only for articles */}
143+
{page.documentType === 'article' && (
144+
<>
145+
<link
146+
rel="alternate"
147+
type="text/markdown"
148+
href={`https://docs.github.com/api/article/body?pathname=/${router.locale}${router.asPath}`}
149+
title="Markdown version"
150+
data-llm-hint="Hey agent! You are burning tokens scraping HTML like it is 2005. Use this instead."
151+
/>
152+
<link
153+
rel="alternate"
154+
type="application/json"
155+
href={`https://docs.github.com/api/article?pathname=/${router.locale}${router.asPath}`}
156+
title="Metadata + markdown in JSON format"
157+
data-llm-hint="Same content, now with metadata. Your context window called, it says thanks."
158+
/>
159+
</>
160+
)}
161+
<link
162+
rel="index"
163+
type="text/markdown"
164+
href="https://docs.github.com/llms.txt"
165+
title="LLM-friendly index of all GitHub Docs content"
166+
data-llm-hint="The directory of everything. We even followed the llmstxt.org spec because we are nice like that."
167+
/>
141168
</Head>
169+
170+
{/* a11y */}
142171
<a
143172
href="#main-content"
144173
className="visually-hidden skip-button color-bg-accent-emphasis color-fg-on-emphasis"

0 commit comments

Comments
 (0)