Back to Docusaurus

no-html-links

website/versioned_docs/version-3.10.0/api/misc/eslint-plugin/no-html-links.mdx

3.10.11014 B
Original Source

no-html-links

import APITable from '@site/src/components/APITable';

Ensure that the Docusaurus <Link> component is used instead of <a> tags.

The <Link> component has prefetching and preloading built-in. It also does build-time broken link detection, and helps Docusaurus understand your site's structure better.

Rule Details

Examples of incorrect code for this rule:

html
<a href="/page">go to page!</a>

<a href="https://x.com/docusaurus" target="_blank">X</a>

Examples of correct code for this rule:

js
import Link from '@docusaurus/Link'

<Link to="/page">go to page!</Link>

<Link to="https://x.com/docusaurus">X</Link>

Rule Configuration

Accepted fields:

mdx-code-block
<APITable>
OptionTypeDefaultDescription
ignoreFullyResolvedbooleanfalseSet to true will not report any <a> tags with absolute URLs including a protocol.
mdx-code-block
</APITable>