Skip to main content

prefer-theme-config-metadata-name-for-twitter-tags

Require themeConfig.metadata Twitter entries to use name instead of property.

Targeted pattern scopeโ€‹

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

What this rule reportsโ€‹

This rule reports metadata entries that use property for static Twitter keys such as twitter:image or twitter:card.

Why this rule existsโ€‹

Twitter/X metadata is conventionally emitted through name. Using the canonical key form keeps metadata consistent with common platform documentation and tooling.

โŒ Incorrectโ€‹

export default {
themeConfig: {
metadata: [{ property: "twitter:image", content: "https://example.com/card.png" }],
},
};

โœ… Correctโ€‹

export default {
themeConfig: {
metadata: [{ name: "twitter:image", content: "https://example.com/card.png" }],
},
};

Behavior and migration notesโ€‹

This rule autofixes by renaming the metadata key from property to name for matching static Twitter entries.

When not to use itโ€‹

Do not use this rule if your metadata pipeline intentionally relies on nonstandard Twitter key handling.

Rule catalog ID: R071

Further readingโ€‹