Skip to main content

no-duplicate-theme-config-metadata-keys

Disallow duplicate themeConfig.metadata keys across static name and property entries.

Targeted pattern scopeโ€‹

This rule targets docusaurus.config.* files and inspects themeConfig.metadata arrays.

What this rule reportsโ€‹

This rule reports duplicate metadata entries that repeat an earlier static name or property key.

Why this rule existsโ€‹

Duplicate metadata keys make site metadata harder to audit and can produce redundant or conflicting document head output.

โŒ Incorrectโ€‹

export default {
themeConfig: {
metadata: [
{ name: "keywords", content: "docs" },
{ name: "keywords", content: "rules" },
],
},
};

โœ… Correctโ€‹

export default {
themeConfig: {
metadata: [
{ name: "keywords", content: "docs, rules" },
],
},
};

Behavior and migration notesโ€‹

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

When not to use itโ€‹

Do not use this rule if duplicate metadata keys are intentionally emitted and resolved by downstream rendering logic.

Rule catalog ID: R059

Further readingโ€‹