If I use the Jekyll SEO tag plugin to add metadata tags for search engines and social networks for improving the indexing of the Website, the plugin generates, in the resulting HTML page, a large number of lines which include void elements such as meta and link.
The Jekyll SEO tag plugin v2.8.0 or below, adds an end tag to each of these void elements as follow:
<meta property="og:title" content="Website Title"/>
<link rel="canonical" href="https://example.com"/>
However, when we validate the resulting HTML page with the W3C Markup Validation Service we receive the following message as outcome:
Info: Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.
In fact, the following link element without trailing slash:
<link rel=canonical href=https://example.com>
is different than the following element with trailing slash:
<link rel=canonical href=https://example.com/>
In the second case (with the trailing slash), https://example.com/ becomes the value of the href attribute in the DOM.
Since https://example.com and https://example.com/ are two different URLs, this could lead to unexpected behaviours and issues if the page is manually amended at some stage, and quotes are removed (i.e.: HTML compression for performance optimizations).
How can I prevent Jekyll SEO tag plugin from adding the trailing slash?