Remove structured data with JavaScript doesn't work for Google bot

91 Views Asked by At

I have an e-commerce subscription where I can only add additional JavaScript for the pages. Since Google Search Console gives warning for the generated HTML I decided first to fix, then to remove schema but on my tests it is now clear to me that google doesn't respect DOM manipulation. What are my other options if any?

The error which is displayed on search console is Missing field "itemListElement"

Here is the test code.

<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <title>test</title>
</head>
<body>
    <ul vocab="https://schema.org/" typeof="BreadcrumbList">
        <li>
            <a href="/" title="Anasayfa"><span>Homepage</span></a>
        </li>
        <li>
            <h1 property="name">All Products <span>21 results</span></h1>
        </li>
    </ul>

    <script>
        var elems = document.querySelectorAll("[vocab]");

        for (var i = 0; i < elems.length; i++) {
            elems[i].removeAttribute("vocab");
        }
    </script>
</body>
</html>
0

There are 0 best solutions below