docs: point readers (and their LLMs) at the markdown renditions (#2427)

This commit is contained in:
Felix Weinberger 2026-07-02 21:34:20 +01:00 • committed by GitHub
commit ddba550fa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 1 deletions

View file

@ -53,6 +53,17 @@ export default defineConfig({
buildEnd(siteConfig) {
generateLlmsArtifacts(docsDir, siteConfig.outDir, siteUrl);
},
transformPageData(pageData) {
// Every guide page has a markdown rendition next to its HTML (llms.ts);
// advertise it to tools via a rel=alternate link. The API reference has none.
if (!pageData.relativePath.startsWith('api/')) {
pageData.frontmatter.head ??= [];
pageData.frontmatter.head.push([
'link',
{ rel: 'alternate', type: 'text/markdown', href: `${siteUrl}/${pageData.relativePath}` }
]);
}
},
themeConfig: {
nav: [
{ text: 'Get started', link: '/get-started/first-server', activeMatch: '^/get-started/' },

View file

@ -0,0 +1,17 @@
<script setup lang="ts">
import { useData, withBase } from 'vitepress';
import { computed } from 'vue';
// Every guide page has a markdown rendition generated next to its HTML (see
// ../llms.ts); the generated API reference does not.
const { page } = useData();
const mdPath = computed(() => (page.value.relativePath.startsWith('api/') ? undefined : withBase(`/${page.value.relativePath}`)));
</script>
<template>
<div v-if="mdPath" class="markdown-source">
Are you an LLM (or feeding one)? This page as
<a :href="mdPath" target="_self">markdown</a> · <a :href="withBase('/llms.txt')" target="_self">llms.txt</a> ·
<a :href="withBase('/llms-full.txt')" target="_self">llms-full.txt</a>
</div>
</template>

View file

@ -171,3 +171,20 @@
text-decoration: underline;
margin-left: 4px;
}
/* --------------------------------------------------- markdown-source footer */
.markdown-source {
margin-bottom: 16px;
padding-top: 16px;
border-top: 1px solid var(--vp-c-divider);
color: var(--vp-c-text-3);
font-size: 12px;
line-height: 1.5;
}
.markdown-source a {
color: var(--vp-c-text-2);
text-decoration: underline;
font-weight: 400;
}

View file

@ -3,13 +3,15 @@ import DefaultTheme from 'vitepress/theme';
import { h } from 'vue';
import Banner from './Banner.vue';
import MarkdownSource from './MarkdownSource.vue';
import './custom.css';
export default {
extends: DefaultTheme,
Layout() {
return h(DefaultTheme.Layout, null, {
'layout-top': () => h(Banner)
'layout-top': () => h(Banner),
'doc-footer-before': () => h(MarkdownSource)
});
}
} satisfies Theme;