[[{"@type":["BlogPosting"],"@id":"https:\/\/www.schemaapp.com\/schema-markup\/schema-markup-filtering-javascript-library\/#BlogPosting","@context":{"@vocab":"http:\/\/schema.org\/","kg":"http:\/\/g.co\/kg"},"url":"https:\/\/www.schemaapp.com\/schema-markup\/schema-markup-filtering-javascript-library\/","publisher":[{"@id":"https:\/\/www.schemaapp.com\/#Organization"}],"audience":"https:\/\/schema.org\/PeopleAudience","inLanguage":[{"@type":"Language","@id":"https:\/\/www.schemaapp.com\/schema-markup\/schema-markup-filtering-javascript-library\/#BlogPosting_inLanguage_Language","name":"English"}],"mentions":[{"@id":"https:\/\/www.schemaapp.com\/entity#Thing17"},{"@id":"https:\/\/www.schemaapp.com\/entity#Thing2"}],"dateModified":"2023-08-23T18:50:31+00:00","headline":"Schema Markup Filtering Javascript Library","datePublished":"2018-10-10T01:47:47+00:00","image":[{"@type":"ImageObject","@id":"https:\/\/www.schemaapp.com\/schema-markup\/schema-markup-filtering-javascript-library\/#BlogPosting_image_ImageObject","url":"https:\/\/www.schemaapp.com\/wp-content\/uploads\/2019\/11\/Schema-Markup-Filtering-Javascript-Library.png"}],"mainEntityOfPage":"https:\/\/www.schemaapp.com\/schema-markup\/schema-markup-filtering-javascript-library\/","name":"Schema Markup Filtering Javascript Library","articleBody":"There are lots of times websites have schema markup added by the CMS or Theme that add disappointing markup. In order to disambiguate the data items on the page, or to control the main entity or change between rich snippets, or just clean up erroneous markup we have a couple of options. First, try to alter the theme or CMS that\u2019s producing, but failing that you can use JavaScript to inspect the page and remove the schema markup.\nFor JavaScript, we\u2019ve published a JavaScript library https:\/\/github.com\/SchemaApp\/schema-filter that can help to handle different scenarios.\nAmong the options, the JS library can be setup to filter combinations of:\n1. Schema Class List (defaults to All)\n2. Schema Syntax RDFa, Microdata or JSON-LD (defaults to microdata)\nIf you have ideas for improvements we can use the GitHub repository features to make suggestions.  Below we\u2019ve included some of the read.me file to give you an idea on how it works and options.\nSchemaFilter\nJavaScript Filter tool to remove Schema markup in JSON-LD, Microdata, or RDFa formats from webpages.\nUsage\nTo the use the script import it using a script tag. We recommend using the CDN version of the script where possible.\n\n\/\/ Using the CDN Version (Recommended)\n<script src=\"https:\/\/cdn.schemaapp.com\/javascript\/schemaFilter.min.js\"><\/script>\n\n\/\/ Loading asyncronously \n<script async src=\"https:\/\/cdn.schemaapp.com\/javascript\/schemaFilter.min.js\"><\/script>\n\n\/\/ Or load it locally\n<script src=\"schemaFilter.js\"><\/script>\n\nModes of removal\nSchema Filter supports the removal of JSON-LD, Microdata, and RDFa. This is done by calling the specific functions or through specifying them by name. Multiple calls to the function can be used to remove more than one format. Each command must be within a <script>\u2026<\/script>.\n\nJSON-LD SchemaFilter.remove([],'json-ld'); or SchemaFilter.removeJSONLD();\nMicrodata SchemaFilter.remove(); or SchemaFilter.removeMicroData();\nRDFa SchemaFilter.remove([],'rdfa'); or SchemaFilter.removeRDFa();\n\nSpecifying specific Types\nSpecifying particular schema classes is done through passing an array to the remove function. If all classes are to be removed then the array may be left empty ([]), or passed in as null.\n\n\/\/ This will remove all Event and Organization types on Microdata\n<script>SchemaFilter.remove(['Event', 'Organization']);<\/script>\n\n\/\/ This will remove LocalBusiness, Organization, and WebSite classes in a JSON-LD format. \n<script>SchemaFilter.remove(['LocalBusiness', 'Organization', 'WebSite'], 'json-ld');<\/script>\n\n\/\/ Remove all classes of rdfa (notice the empty array).\n<script>SchemaFilter.remove([],'rdfa');<\/script>\n\n\/\/ Remove all Organizations of RDFa\n<script>SchemaFilter.remove(['Organization'], 'rdfa');<\/script>\n\n\/\/ Remove all classes of JSON-LD (notice we can also use null for the array).\n<script>SchemaFilter.remove(null,'json-ld');<\/script>\n\n\nRunning the script on your page\nOnce the script is imported you may the run script in another block of JavaScript. The script should be run when the document is ready or after another event that injects Schema Markup into the page. If the markup is embedded in the source you may run when the document is loaded as shown below.\n\n<script>SchemaFilter.remove(null, 'json-ld');<\/script>\n\nIf you want to alter the event in which the code is loaded you can specify the string event value into the onLoad property of the SchemaFilter.\n\n<script>\nSchemaFilter.onLoad = 'SomeEventHere'; \/\/ the default value\nSchemaFilter.remove();\n<\/script>\n\nAt Schema App, we look at schema markup as an iterative process. Through enhanced analytics and content recommendations, we help our customers maximize their results through structured data. If you need help getting started, get in touch today!\nStart reaching your online business goals with structured data.Let\u2019s Talk\n ","description":"In order to disambiguate the data items on the page, to control the main entity, or to clean up erroneous markup we have a couple of options."},{"@context":"http:\/\/schema.org","@type":"Organization","address":{"@type":"PostalAddress","streetAddress":"201 - 412 Laird Road","postalCode":"N1G 3X7","addressRegion":"Ontario","addressLocality":"Guelph","addressCountry":"https:\/\/www.schemaapp.com\/#Country","name":"Schema App Address","@id":"https:\/\/www.schemaapp.com\/#PostalAddress"},"logo":{"@type":"ImageObject","width":"290","height":"93","url":"https:\/\/ezk8caoodod.exactdn.com\/wp-content\/uploads\/2020\/07\/SA_Logo_Main_Orange_w300-1.png?strip=all&lossy=1&ssl=1","@id":"https:\/\/ezk8caoodod.exactdn.com\/wp-content\/uploads\/2020\/07\/SA_Logo_Main_Orange_w300-1.png?strip=all&lossy=1&ssl=1"},"potentialAction":{"@type":"ScheduleAction","name":"Schedule a Demo","url":"https:\/\/www.schemaapp.com\/book-a-demo\/","@id":"https:\/\/www.schemaapp.com\/#ScheduleAction"},"image":{"@type":"ImageObject","width":"1350","height":"650","url":"https:\/\/ezk8caoodod.exactdn.com\/wp-content\/uploads\/2021\/04\/Schema-App-Featured-Image.png?strip=all&lossy=1&ssl=1","@id":"https:\/\/ezk8caoodod.exactdn.com\/wp-content\/uploads\/2021\/04\/Schema-App-Featured-Image.png?strip=all&lossy=1&ssl=1"},"description":"Schema App is an end-to-end Schema Markup solution that helps enterprise SEO teams develop a knowledge graph and drive search performance.","knowsAbout":["http:\/\/www.wikidata.org\/entity\/Q1891170","https:\/\/www.wikidata.org\/wiki\/Q6108942","https:\/\/www.wikidata.org\/wiki\/Q26813700","https:\/\/www.wikidata.org\/wiki\/Q180711","http:\/\/www.wikidata.org\/entity\/Q33002955"],"keywords":["Structured Data","Knowledge Graph","Rich Results","Semantic Search","Search Engine Optimization","Schema Markup","Semantic Technology"],"location":"http:\/\/www.wikidata.org\/entity\/Q504114","sameAs":["https:\/\/www.instagram.com\/lifeatschemaapp\/","https:\/\/www.linkedin.com\/company\/2480720\/","https:\/\/twitter.com\/schemaapptool","https:\/\/www.youtube.com\/channel\/UCqVBXnwZ3YNf2BVP1jXcp6Q"],"legalName":"Hunch Manifest Inc","name":"Schema App","telephone":"+18554448624","url":"https:\/\/www.schemaapp.com\/","email":"support@schemaapp.com","knowsLanguage":"http:\/\/www.wikidata.org\/entity\/Q1860","areaServed":"http:\/\/www.wikidata.org\/entity\/Q13780930","@id":"https:\/\/www.schemaapp.com\/#Organization"},{"@context":"http:\/\/schema.org","@type":"Thing","description":"WHATWG HTML specification used to nest metadata within existing content on web. Similar to RDFa.","name":"Microdata","sameAs":["http:\/\/www.wikidata.org\/entity\/Q3312185","https:\/\/en.wikipedia.org\/wiki\/Microdata_(HTML)","kg:\/m\/09v5jrb"],"@id":"https:\/\/www.schemaapp.com\/entity#Thing17"},{"@context":"http:\/\/schema.org","@type":"Thing","name":"JSON-LD","sameAs":["https:\/\/www.wikidata.org\/wiki\/Q6108942","kg:\/m\/0hzq_55","https:\/\/en.wikipedia.org\/wiki\/JSON-LD"],"description":"JSON-LD is a method of encoding linked data using JSON. One goal for JSON-LD was to require as little effort as possible from developers to transform their existing JSON to JSON-LD. JSON-LD allows data to be serialized in a way that is similar to traditional JSON.","@id":"https:\/\/www.schemaapp.com\/entity#Thing2"}],{"@context":"https:\/\/schema.org\/","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Schema Markup","item":"https:\/\/www.schemaapp.com\/schema-markup\/#breadcrumbitem"},{"@type":"ListItem","position":2,"name":"Schema Markup Filtering Javascript Library","item":"https:\/\/www.schemaapp.com\/schema-markup\/schema-markup-filtering-javascript-library\/#breadcrumbitem"}]}]