-
Notifications
You must be signed in to change notification settings - Fork 253
feat: improve agent readability and discovery #2233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
benjamincanac
wants to merge
26
commits into
main
Choose a base branch
from
feat/agent-readability
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
b746ef3
feat: add agent discovery surfaces
benjamincanac 8e9fc59
feat: add canonical, JSON-LD and markdown alternate per page
benjamincanac 64dcdd2
feat: add sitemap.md, lastmod and trim llms.txt
benjamincanac f512c86
chore: bump @nuxt/test-utils setup version
benjamincanac 991c02c
refactor: derive URLs from useSiteConfig and prerender sitemap.md
benjamincanac c7384d1
fix: align agent surfaces with robots.txt and clean up payloads
benjamincanac c59a7ee
fix(sitemap-md): mirror sitemap.xml scope (drop v3 docs)
benjamincanac 7d59b25
chore(sitemap): rename sitemap.xml.ts to .get.ts for consistency
benjamincanac d122dc8
Merge branch 'main' into feat/agent-readability
benjamincanac 3709708
fix(agent-discovery): hardcode canonical domain & strip trailing slash
benjamincanac c3c5f00
fix(agent-readability): address self-review feedback
benjamincanac 22bd0b3
fix(agent-readability): add Vary header on /raw/** rewrite destinations
benjamincanac 6cf4872
refactor(agent-readability): migrate to nuxt-schema-org v6 + dedupe i…
benjamincanac eb9f7bc
refactor: drop queryCollectionWithEvent type cast
benjamincanac c213d38
refactor: centralize docs version constants in shared/utils/docs
benjamincanac abc2ae0
chore: remove @takumi-rs/wasm dev dependency
benjamincanac d85b6cb
fix: read WebSite name from siteConfig
benjamincanac 1f0fd62
Merge branch 'main' into feat/agent-readability
benjamincanac e1f35d5
refactor: split server utils into site.ts and agent.ts
benjamincanac acc76d0
fix: set Content-Type on sitemap.xml + type-safe CURRENT_DOCS_VERSION
benjamincanac 0a9de43
fix(nuxt.config): configure evlog exclude
benjamincanac 7e43af5
Merge branch 'main' into feat/agent-readability
HugoRCD 1039061
fix(nuxt.config): update og image timeout
benjamincanac 93c24ff
sample every info logs
HugoRCD 58327eb
fix(nuxt.config): disable evlog in ci
benjamincanac 568ef88
fix(nuxt.config): disable og image cache
benjamincanac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { withoutTrailingSlash } from 'ufo' | ||
| import { toValue, type MaybeRefOrGetter } from 'vue' | ||
|
|
||
| // Adds a canonical URL for the current route plus, optionally, a | ||
| // `rel="alternate"; type="text/markdown"` link pointing at the agent-friendly | ||
| // markdown counterpart. Vercel rewrites the public `.md` URLs to the | ||
| // underlying `/raw/**` handlers (see `modules/md-rewrite.ts`). | ||
| export function useCanonical(markdownAlternate?: MaybeRefOrGetter<string | null | undefined>) { | ||
| const route = useRoute() | ||
| const site = useSiteConfig() | ||
|
|
||
| useHead({ | ||
| link: computed(() => { | ||
| const url = withoutTrailingSlash(site.url) | ||
| const path = route.path === '/' ? '' : route.path.replace(/\/$/, '') | ||
|
|
||
| const links: Array<{ rel: string, href: string, type?: string }> = [ | ||
| { rel: 'canonical', href: `${url}${path}` } | ||
| ] | ||
|
|
||
| const md = toValue(markdownAlternate) | ||
| if (md) { | ||
| const href = md.startsWith('http') ? md : `${url}${md.startsWith('/') ? md : `/${md}`}` | ||
| links.push({ rel: 'alternate', type: 'text/markdown', href }) | ||
| } | ||
|
|
||
| return links | ||
| }) | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,17 @@ | ||
| import { SUPPORTED_DOC_VERSIONS, EXCLUDED_DOC_VERSIONS, CURRENT_DOCS_VERSION } from '#shared/utils/docs' | ||
|
|
||
| // Versions kept here as a fast prefix scan — the canonical list lives in | ||
| // `shared/utils/docs.ts` (SUPPORTED_DOC_VERSIONS + EXCLUDED_DOC_VERSIONS). | ||
| const KNOWN_DOC_VERSIONS = [...SUPPORTED_DOC_VERSIONS, ...EXCLUDED_DOC_VERSIONS] | ||
|
|
||
| export default defineNuxtRouteMiddleware((to) => { | ||
| if (to.path.startsWith('/docs/') && !to.path.startsWith('/docs/5.x') && !to.path.startsWith('/docs/4.x') && !to.path.startsWith('/docs/3.x')) { | ||
| return to.fullPath.replace('/docs', '/docs/4.x') | ||
| } | ||
| if (!to.path.startsWith('/docs/')) return | ||
| if (KNOWN_DOC_VERSIONS.some(v => to.path.startsWith(`/docs/${v}`))) return | ||
|
|
||
| // 302 (not 301): the target version flips when a new stable release | ||
| // ships and we don't want browsers/CDNs caching stale 301s pointing at | ||
| // /docs/4.x/*. Note: prerendered pages can't emit a real HTTP redirect, | ||
| // so the static output falls back to a meta-refresh stub — modern | ||
| // crawlers and clients still follow it. | ||
| return navigateTo(to.fullPath.replace('/docs', `/docs/${CURRENT_DOCS_VERSION}`), { redirectCode: 302 }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.