Skip to main content

no-duplicate-head-tags

Disallow duplicate top-level headTags entries in Docusaurus config.

Targeted pattern scopeโ€‹

This rule targets docusaurus.config.* files and inspects the top-level headTags array.

What this rule reportsโ€‹

This rule reports later headTags object entries that repeat an earlier tag definition with the same serialized signature.

Why this rule existsโ€‹

Duplicate head tags create noisy document metadata, repeated preload/preconnect hints, and harder-to-review config.

โŒ Incorrectโ€‹

export default {
headTags: [
{
tagName: "link",
attributes: { rel: "preconnect", href: "https://github.com" },
},
{
tagName: "link",
attributes: { rel: "preconnect", href: "https://github.com" },
},
],
};

โœ… Correctโ€‹

export default {
headTags: [
{
tagName: "link",
attributes: { rel: "preconnect", href: "https://github.com" },
},
],
};

Behavior and migration notesโ€‹

This rule autofixes by removing later duplicate headTags entries after the first occurrence.

When not to use itโ€‹

Do not use this rule if duplicate top-level head tags are intentionally emitted for downstream processing.

Rule catalog ID: R061

Further readingโ€‹