Using Schema Filter to Remove Default Markup

Modified on Wed, 26 Oct 2022 at 04:25 PM

Schema Filter is designed to remove problematic or default markup created by a theme or plugin. SchemaFilter can remove all major formats of schema markup including, microdata, json-ld, and rdfa. 


You can add SchemaFIlter to your site with the following script tag. (NOTE: This is required to come before you use any of the scripts below)


<script src="https://cdn.schemaapp.com/javascript/schemaFilter.min.js"></script>


How do I Identify which markup I need to remove?


You can tell by examining your HTML structure and looking common attributes. 


Microdata (most common)


Microdata uses attributes in the HTML like itemscope, itemtype, and itemprop to produce markup if you seeing attributes in your HTML that contain those attributes like the example below you have microdata. 


<div itemscope itemtype="https://schema.org/SportsTeam">
    <span itemprop="name">San Francisco 49ers</span>
    <div itemprop="member" itemscope itemtype="https://schema.org/OrganizationRole">
        <div itemprop="member" itemscope itemtype="https://schema.org/Person">
            <span itemprop="name">Joe Montana</span>
        </div>
        <span itemprop="startDate">1979</span>
        <span itemprop="endDate">1992</span>
        <span itemprop="roleName">Quarterback</span>
    </div>
</div>

You can remove Microdata using the Schema Filter with the following examples. 


// Remove all classes of microdata.
<script>SchemaFilter.remove();</script>

// Remove all Organizations of RDFa
<script>SchemaFilter.remove(['Organization']);</script>

JSON-LD


JSON-LD is contained within script tags of type application/ld+json you will be able to spot them by looking for those type of scripts. One must be careful in removing JSON-LD with the filter because you can remove markup produced by Schema App since JSON-LD is the type of markup produced. Make sure to specify the exact schema types you want to remove, and that they are different from what you are deploying in Schema App. If the types are the same it is suggested that you contact your theme/plugin developer for instructions on removing that markup. 


<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "SportsTeam",
  "name": "San Francisco 49ers",
  "member": {
    "@type": "OrganizationRole",
    "member": {
      "@type": "Person",
      "name": "Joe Montana"
    },
    "startDate": "1979",
    "endDate": "1992",
    "roleName": "Quarterback"
  }
}
</script>

You can remove JSON-LD using the Schema Filter with the following examples. We do not recommend you remove all JSON-LD if you are going to deploying markup using a Schema App integration. 


// This will remove LocalBusiness, Organization, and WebSite classes in a JSON-LD format. 
<script>SchemaFilter.remove(['LocalBusiness', 'Organization', 'WebSite'], 'json-ld');</script>


RDFa


RDFa can be identified by looking for property and typeof attributes in your HTML. If you are seeing these properties (example below) you will want to remove RDFa using the filter. 


<div vocab="https://schema.org/" typeof="SportsTeam">
    <span property="name">San Francisco 49ers</span>
    <div property="member" typeof="OrganizationRole">
        <div property="member" typeof="https://schema.org/Person">
            <span property="name">Joe Montana</span>
        </div>
        <span property="startDate">1979</span>
        <span property="endDate">1992</span>
        <span property="roleName">Quarterback</span>
    </div>
</div>


You can remove RDFa using the following snippet for the SchemaFilter


// Remove all classes of rdfa (notice the empty array).
<script>SchemaFilter.remove([],'rdfa');</script>

// Remove all Organizations of RDFa
<script>SchemaFilter.remove(['Organization'], 'rdfa');</script>


Note: Recommended solution is to have the markup removed. However, in scenarios where changes could take a long time, using above procedure is a good option. 









Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article