require-site-url-origin
Require top-level Docusaurus url to be an absolute site origin (for example https://example.com).
Targeted pattern scopeโ
This rule targets docusaurus.config.* files and inspects the top-level url field.
What this rule reportsโ
This rule reports when url is:
- missing,
- not a valid absolute URL string,
- configured with path/query/hash fragments, or
- configured as
httpfor non-localhost origins.
Why this rule existsโ
Docusaurus treats url as the canonical site origin for generated metadata and absolute URLs. Keeping url at origin scope avoids accidental path duplication and canonical URL drift.
โ Incorrectโ
export default {
url: "http://example.com/docs/",
};
export default {
baseUrl: "/docs/",
};
โ Correctโ
export default {
url: "https://example.com",
};
export default {
url: "http://localhost:3000",
};
Behavior and migration notesโ
This rule autofixes direct string and no-expression template-literal values to a normalized origin string.
For identifier-backed values, it reports and provides a suggestion to replace the property value with a normalized literal.
When not to use itโ
Do not use this rule if your project intentionally stores non-origin values in url and handles canonical URL generation through custom tooling.
Rule catalog ID: R050