astrolib
astrolib copied to clipboard
@astrolib/seo -- Meta and Link tags should not use void style
In: https://github.com/onwidget/astrolib/blob/b7a454fc374ffef915e2e8e00167a341209cfdf9/packages/seo/src/utils/buildTags.ts#L4-L16
Both the <link>
and <meta>
are using a void style closing method, which is not in the HTML standards:
https://html.spec.whatwg.org/multipage/syntax.html#void-elements
When linting code with html-validate
it finds it using this:
https://html-validate.org/rules/void-style.html
I recommend just removing the void-style
const createMetaTag = (attributes: Record<string, string>): string => {
const attrs = Object.entries(attributes)
.map(([key, value]) => `${key}="${escape(value)}"`)
.join(" ");
return `<meta ${attrs}>`;
};
const createLinkTag = (attributes: Record<string, string>): string => {
const attrs = Object.entries(attributes)
.map(([key, value]) => `${key}="${escape(value)}"`)
.join(" ");
return `<link ${attrs}>`;
};
Details
When linting just the 404.html
from astrowind:
1:1926 error Expected omitted end tag <meta> instead of self-closing element <meta/> void-style
1:1970 error Expected omitted end tag <meta> instead of self-closing element <meta/> void-style
1:2036 error Expected omitted end tag <link> instead of self-closing element <link/> void-style
1:2083 error Expected omitted end tag <meta> instead of self-closing element <meta/> void-style
1:2182 error Expected omitted end tag <meta> instead of self-closing element <meta/> void-style
1:2253 error Expected omitted end tag <meta> instead of self-closing element <meta/> void-style
1:2297 error Expected omitted end tag <meta> instead of self-closing element <meta/> void-style
1:2403 error Expected omitted end tag <meta> instead of self-closing element <meta/> void-style
1:2444 error Expected omitted end tag <meta> instead of self-closing element <meta/> void-style
1:2507 error Expected omitted end tag <meta> instead of self-closing element <meta/> void-style