How to Use Path Rules to Avoid Generating Unwanted Schemas

When integrating Website Schema, you may encounter situations where our service generates schemas for pages that you don't actually want to process or that don't make sense to have schema made for. This can be especially problematic if you don't have complete control over the templating or content generation process. Today we are rolling out path rules to filter out unwanted URLs before they trigger schema generation.

In this tutorial, we'll walk through:

  • Understanding and Configuring Path Rules
  • Testing Your Implementation

Where to find Paths Rules

Each website that you have added to your account has its own rules. Find this setting by clicking on your website in the Dashboard

Paths Rules in Website Schema Dashboard

Understanding and Configuring Path Rules

With Paths Rules you have two options:

  • Exclude Paths

  • Only Include Paths

These are self-explanatory. Exclude Paths will exclude all URLs that fit the rule. Only include paths will do the reverse of it.

A. Only Include Paths:
Only URLs that match these patterns are allowed.
Example:
json { "/htmls/*, /test-htmls/*" }

In this case, only URLs starting with /htmls/ or /test-htmls/ will be processed. Everything else will not be processed.

B. Exclude Paths:
URLs that match these patterns are not allowed.
Example:
json { "/htmls/*, /test-htmls/*" }

In this case, all URLs will be processed except URLs starting with /htmls/ or /test-htmls/.

**Important: always start your paths with / and separate them with commas , when listing more than one path **

If you want to delete any active paths rules, simply clear out the field and click save, you should get the confirmation that rules were deleted.

Testing Your Implementation

To verify that your rules are working as intended. Open your website at any page that should not have schema supplied. If you are in Chrome, use right-click on your mouse and choose Inspect. Pop up window with a lot of code will appear. Navigate to Console. Hit refresh button in a browser to reload the page.

Integration script should show the following:

No schema for this page served: empty or path rules working

If you see this message it means that schema generation and retrieval was successfully blocked by paths rules.


If you have any questions or cannot get it to work, please reach out to us!.

Sign up for our newsletter

Hot technical SEO tips and tricks in your newsletter without spam.

We care about the protection of your data. Read our Privacy Policy

From the blog

Learn more about schema and technical SEO strategies!