Xref (Astro)
Xref (Astro)
Reference documents within the same repository.
Astro Only Documentation Below for docs.chocolatey.org
The documentation below covers how to use the
<Xref />
Astro Component on docs.chocolatey.org. At this time, this Component is only available on docs.chocolatey.org.
Overview
The <Xref />
Component aims to give a way to link to documents within the same repository where the url will always work even if the file location changes. In the frontmatter of a .mdx
or .md
file, an xref key is assigned. When the files are compiled, the xref translates into an <a />
link. Things to know:
- xref keys can never change once assigned.
- No two files can have the same xref.
- An xref key is required.
Define the Xref
Use the Xref in another file
Xrefs with Anchor Links
The <Xref />
Component accepts an anchor="value"
where the value
is the Id of the anchor to target.