You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Renderer handles booleans — packages/docusaurus/src/server/htmlTags.ts:68-70 explicitly handles boolean attributes, rendering true as the attribute name alone and false as omitted
Sibling scripts config accepts booleans — configValidation.ts uses .unknown() which allows boolean values, and the docs say "you might want to add async: true/defer: true"
npx create-docusaurus@3.10.1 my-repro classic --javascript
cd my-repro
Add this to docusaurus.config.js:
constconfig={headTags: [{tagName: 'script',attributes: {src: '/analytics.js',async: true,},},],// ... rest of config};
Run:
npm run build
Expected behavior
The configuration should accept valid HTML boolean attributes such as async, defer, and disabled, consistent with the published TypeScript types and rendering behavior.
Actual behavior
Build fails with:
[ERROR] Error: "headTags[0].attributes.async" must be a string
The validation schema uses Joi.string() which restricts all attribute values to strings, contradicting the TypeScript type definition and the renderer's boolean handling.
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clearoryarn clearcommand.rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages.Description
The
headTagsconfiguration rejects boolean HTML attribute values during validation, despite three pieces of evidence showing this is unintentional:@docusaurus/typesdefinesattributes?: Partial<{[key: string]: string | boolean}>packages/docusaurus/src/server/htmlTags.ts:68-70explicitly handles boolean attributes, renderingtrueas the attribute name alone andfalseas omittedscriptsconfig accepts booleans —configValidation.tsuses.unknown()which allows boolean values, and the docs say "you might want to addasync: true/defer: true"Reproducible demo
https://new.docusaurus.io — create a new project and add the
headTagsconfig shown below.Steps to reproduce
npx create-docusaurus@3.10.1 my-repro classic --javascript cd my-reprodocusaurus.config.js:Expected behavior
The configuration should accept valid HTML boolean attributes such as
async,defer, anddisabled, consistent with the published TypeScript types and rendering behavior.Actual behavior
Build fails with:
The validation schema uses
Joi.string()which restricts all attribute values to strings, contradicting the TypeScript type definition and the renderer's boolean handling.Your environment
Self-service