GithubHelp home page GithubHelp logo

isabella232 / schema-filter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from schemaapp/schema-filter

0.0 0.0 0.0 15 KB

JavaScript Filter tool to remove Schema markup in JSON-LD, Microdata, or RDFa formats.

JavaScript 100.00%

schema-filter's Introduction

SchemaFilter

JavaScript Filter tool to remove Schema markup in JSON-LD, Microdata, or RDFa formats from webpages.

Usage

To the use the script import it using a script tag. We recommend using the CDN version of the script where possible.

// Using the CDN Version (Recommended)
<script src="https://cdn.schemaapp.com/javascript/schemaFilter.min.js"></script>

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

// Or load it locally
<script src="schemaFilter.js"></script>	

Modes of removal

Schema 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>...</script>.

  • JSON-LD SchemaFilter.remove([],'json-ld'); or SchemaFilter.removeJSONLD();
  • Microdata SchemaFilter.remove(); or SchemaFilter.removeMicroData();
  • RDFa SchemaFilter.remove([],'rdfa'); or SchemaFilter.removeRDFa();

Specifying specific Types

Specifying 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.

// This will remove all Event and Organization types on Microdata
<script>SchemaFilter.remove(['Event', 'Organization']);</script>

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

// 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>

// Remove all classes of JSON-LD (notice we can also use null for the array).
<script>SchemaFilter.remove(null,'json-ld');</script>

Running the script on your page

Once 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.

<script>SchemaFilter.remove(null, 'json-ld');</script>

If 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.

<script>
SchemaFilter.onLoad = 'SomeEventHere'; // the default value
SchemaFilter.remove();
</script>

schema-filter's People

Contributors

joelacummings avatar vberkel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.