Link index
A Link Index is a JSON file (links.json
) that contains all the linkable resources for a specific repository branch.
The Link Index enables:
- Cross-repository linking: Other documentation sets can link to your content.
- Link validation: Validate that links to your content are correct.
- Inbound link detection: Know when other repositories link to your content.
- Distributed builds: Build documentation independently while maintaining link integrity.
Each repository branch gets its own Link Index file in the Link Service, organized by:
- Organization: e.g.,
elastic
. - Repository: e.g.,
elasticsearch
. - Branch: e.g.,
main
,8.x
,7.17
.
View Elasticsearch's main branch Link Index to see a real example.
The Link Index contains:
- All documentation pages in the repository.
- Headings within those pages.
- Anchors and linkable elements.
- Version information.
- Metadata about the build.
The Link Index is automatically generated during a documentation build:
docs-builder
builds the documentation set- During the build, all linkable resources are tracked
- After a successful build, a
links.json
file is written to.artifacts/docs/html/links.json
- CI/CD publishes this file to the Link Service
When you use a cross-link like elasticsearch://reference/api/search.md
, docs-builder
:
- Fetches the Elasticsearch Link Index from the Link Service
- Looks up the path in the index
- Validates the link exists
- Resolves it to the correct URL
When building your documentation, docs-builder
can:
- Fetch your repository's Link Index from previous builds
- Compare with your current local changes
- Detect if you've moved or deleted files that other repositories link to
- Warn about breaking changes
During a build, the Link Index is written to:
.artifacts/docs/html/links.json
After publishing, it's available at:
https://elastic-docs-link-index.s3.us-east-2.amazonaws.com/{org}/{repo}/{branch}/links.json
- Link Service - Where Link Index files are stored.
- Link Catalog - Catalog of all Link Index files.
- Outbound Cross-links - Links that use the Link Index.
- Inbound Cross-links - Links to resources in the Link Index.