htacg / tidy-html5

The granddaddy of HTML tools, with support for modern standards
http://www.html-tidy.org
2.72k stars 420 forks source link

Prevent HTML Tidy from messing meta tags ( schema markup ) #750

Open designgrande opened 6 years ago

designgrande commented 6 years ago

I am facing a serious problem with HTML Tidy (latest version -- https://html-tidy.org).

In short: HTML tidy convert these lines of HTML codes

<div class="breadcrumbs" typeof="BreadcrumbList" vocab="http://schema.org/">
<div class="wrap">
    <span property="itemListElement" typeof="ListItem">
        <a property="item" typeof="WebPage" title="Codes Category" href="https://mysite.works/codes/" class="taxonomy category">
            <span property="name">Codes</span>
        </a>
        <meta property="position" content="1">
    </span>
</div>

Into these lines of code -- Please take a close look at META TAGS placement.

<div class="breadcrumbs" typeof="BreadcrumbList" vocab="http://schema.org/">
<div class="wrap">
    <span property="itemListElement" typeof="ListItem">
        <a property="item" typeof="WebPage" title="Codes Category" href="https://mysite.works/codes/" class="taxonomy category">
            <span property="name">Codes</span>
        </a>
    </span>
    <meta property="position" content="1">
</div>

This is causing some serious issues with schema validations. You can check the codes here: https://search.google.com/structured-data/testing-tool/u/0/

Because of this issue, the client's (URL: https://techswami.in ) breadcrumb navigation is not visible in search results.

What help do I need from you guys?

Can you please tell me how do I prevent HTML Tidy from messing the META TAGS.

Thanks.

cmb69 commented 6 years ago

It seems to me that according to the HTML 5.2 specification, this usage of the <meta> element is not allowed.

Seirdy commented 1 year ago

Same issue for microdata on https://seirdy.one/

Looking at the HTML Living Standard, it should be allowed with the itemprop attribute. I believe it should work with RDFa attributes such as property, typeof, and vocab as well.