Cross-links

All build modes — isolated, assembler, and codex — support cross-linking between documentation sets. Cross-links let you reference pages in other repositories using a validated, portable syntax instead of hardcoded URLs.

[Getting started with Elasticsearch](elasticsearch://reference/getting-started.md)
		

The format is <repository>://<path-to-file>. The repository name matches the GitHub repository name without the org prefix. You can also link to specific headings:

[Query DSL](elasticsearch://reference/query-dsl.md#match-query)
		

Before using cross-links, declare the target repositories in your docset.yml:

cross_links:
  - elasticsearch
  - kibana
  - docs-content
		

This tells docs-builder to fetch the link index for each listed repository so it can validate your cross-links at build time — even during local development.

Tip

Only list repositories you actually link to. Each entry adds a link-index fetch during builds.

Mermaid diagram
  1. Fetch — downloads the target repository's link index from the link service
  2. Look up — checks that the referenced path (and anchor, if specified) exists in the index
  3. Resolve — replaces the cross-link with the correct URL for the current build mode
  4. Error — produces a build error if the target doesn't exist

The resolved URL depends on context — in isolated builds it points to the live site, in assembler builds it resolves to the local path within the unified output.

In isolated and codex builds, when docs-builder cannot fetch the link index of a repository listed under cross_links, it reports one diagnostic on docset.yml. It does not report an error for every link. The diagnostic is:

  • an error when at least one page links to that repository
  • a warning when no page links to it, because no cross-link went unvalidated

The affected cross-links are not validated. Each one renders as the path you wrote, with its anchor, and docs-builder does not check that the page or anchor exists. The next build compiles every page again, so it validates them once access is back.

To restore access, fix the cause that the diagnostic names:

  • Locally, run docs-builder codex clone first, or make sure you can reach git@github.com:elastic/codex-link-index.git over SSH.
  • In CI, give the job a GITHUB_TOKEN that can read elastic/codex-link-index. Jobs for pull requests from forks do not receive the token that grants this, so push the branch to the upstream repository.
  • For a repository that is missing from the index, check the name under cross_links, and check that the repository has published its link index.

Assembler builds fetch their link indexes from assembler.yml and stop when a fetch fails. They produce no diagnostic and no fallback links.

To skip the fetch on purpose, pass --skip-cross-links to the isolated build. That validates no cross-link in the build. Use it for a quick check, not for a build that gates a merge.

You can check whether changes to your documentation would break links from other repositories:

docs-builder inbound-links validate-link-reference
docs-builder inbound-links validate-all
		

This downloads all published link indexes and checks if any of them reference pages you've moved or deleted. Common scenarios:

  • Renaming a page — other repos may link to the old path
  • Removing a heading — a heading change can break fragment links from other repos
  • Reorganizing structure — moving files between directories invalidates existing cross-links

When inbound validation fails, it reports which repos and files contain the broken references, so you can coordinate fixes or add redirects.

For how all of this is enabled by the distributed build model, see distributed builds.