=== Dotes Auto Schema ===
Contributors: dotes
Tags: schema, structured data, json-ld, rich results, open graph
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Schema.org structured data in a single JSON-LD @graph per page, with automation rules, schema blocks and per-post control.

== Description ==

Dotes Auto Schema adds schema.org structured data (JSON-LD) to your site so search engines can understand your content and show rich results.

Everything the plugin knows about a page is printed once, as a single `@graph` in the `<head>`:

* **Site nodes**: WebSite and the Organization or Person behind the site.
* **Page node**: WebPage, linked to the site nodes.
* **Automation rules**: choose a schema type by post type or taxonomy term. Rules run in the order you set by drag and drop. Each property is filled from the post's own data (title, excerpt, content, dates, author, URL, featured image, site name) or a fixed value you type. Rich result types (Recipe, Event, HowTo, Product and the others) are only used when the post has the fields Google requires; otherwise the next matching rule is used.
* **Schema blocks**: 16 Gutenberg blocks that render the content and add the matching node: FAQ, How-to, Review, Product, Product Group, Software Application, Local Business, Restaurant, Event, Course, Job Posting, Recipe, Video, Movie, Book and Music Playlist. All 16 are active on install; a type turned off in the Schemas tab hides its block from the inserter and stops its schema, while the blocks already in posts keep their content.
* **Per-post control**: in the post editor, follow the rules, pick another schema type, paste your own JSON-LD or disable the schema for that post.

Other features:

* Schema library with 24 types: Article, BlogPosting, NewsArticle, WebPage, FAQPage, HowTo, Product, ProductGroup, Review, SoftwareApplication, LocalBusiness, Restaurant, Event, Course, JobPosting, Recipe, VideoObject, Movie, Book, MusicPlaylist, WebSite, Organization, Person and BreadcrumbList.
* Local validation of required and recommended fields.
* Open Graph, X (Twitter) Cards and Pinterest meta tags, with a compatibility mode that stays quiet when Yoast SEO, Rank Math, All in One SEO, SEOPress, The SEO Framework or Jetpack already prints them.
* Works alongside Yoast SEO, Rank Math and All in One SEO: the site, page and article nodes they already print are not duplicated.
* Page views do not write to the database.

= For developers =

The output can be changed through filters and actions:

* `dotes_schema_graph`, `dotes_schema_node`, `dotes_schema_node_{type}` and `dotes_schema_should_output` to add, change or skip nodes.
* `dotes_schema_register_types` to register schema types.
* `dotes_schema_condition_types`, `dotes_schema_condition_type_supported` and `dotes_auto_schema_evaluate_condition` to add rule conditions (in the rule editor, `window.dotesSchemaConditions` renders their fields).
* `dotes_schema_from_post`, `dotes_schema_mapping_sources`, `dotes_schema_mapping_source_supported`, `dotes_schema_default_mappings`, `dotes_auto_schema_default_mappings` and `dotes_auto_schema_transform_schema` for field mapping (in the rule editor, `window.dotesSchemaMappingSources` adds mapping sources).
* `dotes_schema_block_eligible`, `dotes_schema_register_blocks` and `dotes_schema_block_schema` for blocks.
* `dotes_schema_validator_rules` for validation rules.
* `dotes_schema_admin_tabs`, `dotes_schema_admin_tab_content`, `dotes_schema_save_options` and `dotes_schema_metabox_after_fields` for the admin screens.
* `dotes_auto_schema_opengraph_data`, `dotes_auto_schema_x_card_data`, `dotes_auto_schema_pinterest_data` and `dotes_auto_schema_opengraph_conflicts` for social meta tags.

== External services ==

The plugin does not send data to external services. One button only opens an external tool in a new tab when you click it, passing the public URL being tested:

* "Open Google Rich Results Test" in the post editor opens [Google Rich Results Test](https://search.google.com/test/rich-results) ([terms](https://policies.google.com/terms), [privacy](https://policies.google.com/privacy)).

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install it from the Plugins screen.
2. Activate the plugin.
3. Follow the setup wizard, or open **Auto Schema** in the admin menu to choose the post types, schema types and automation rules.

== Third-party libraries ==

* Font Awesome Free 6.7.2 — icons CC BY 4.0, fonts SIL OFL 1.1, code MIT (assets/vendor/fontawesome/LICENSE.txt). Bundled locally, used only in the admin screens.

== Frequently Asked Questions ==

= Why is my post not output as Recipe, Event or another rich result type? =

Recipe, Event, HowTo, Product and the other rich result types are only printed when the post has the fields Google requires (for a recipe: ingredients, instructions and an image). When the post does not have them, the next automation rule that matches is used, for example Article. Map the fields in the rule (post data or fixed values) or use the schema block in the post, which has a field for each property.

= Does it conflict with Yoast SEO, Rank Math or All in One SEO? =

When one of them is active, this plugin does not print the WebSite, Organization, Person, WebPage, BreadcrumbList and article nodes they already print. Content nodes (FAQ, HowTo, Recipe, Product, Event and the other blocks) and the schema set in the post editor are always printed. Developers can change this with the `dotes_schema_should_output` filter.

= Does it work with WooCommerce? =

Yes. WooCommerce already prints the Product schema of its product pages, so on those pages the Product and ProductGroup nodes of automation rules are not printed. Product blocks and the schema set in the post editor are still printed.

= Where do automation rules take the values from? =

From the post's own data (title, excerpt, content, dates, author, URL, featured image, site name) and from fixed values you type in the rule. The schema blocks take the values you type in them. Developers can register more mapping sources with the `dotes_schema_mapping_sources` and `dotes_schema_mapping_source_supported` filters.

= How do I check the result? =

Open a post and view the page source: look for `<script type="application/ld+json" class="dotes-schema-graph">`. You can also use the "Open Google Rich Results Test" button in the post editor.

= Can I turn the schema off for one post? =

Yes. In the "Schema Markup" box of the post editor, choose "Disable schema on this page".

= What is removed when I delete the plugin? =

The plugin options, its transients and the post meta it created. Your posts and the blocks inside them are not changed.

== Screenshots ==

1. Dashboard: active schema types, how they are distributed and which published posts have schema.
2. Schema library: turn on the schema types your site uses, grouped by kind of content.
3. Automation rules: apply a schema type by post type or taxonomy term, in the order you set.

== Changelog ==

= 1.1.1 =
* Block output: translated labels and values are escaped.
* Admin texts and readme describe only what this plugin does.

= 1.1.0 =
* Changed: automation rules fill the schema from the post's own data and fixed values. Mappings saved from a source that is not available are kept, and those properties are left out.
* Product block: price, SKU, GTIN, MPN, brand and rating typed in the block are used on any post.
* The JSON-LD is printed with the WordPress script functions.
* New developer hooks: `dotes_schema_from_post`, `dotes_schema_default_mappings`, `dotes_schema_mapping_source_supported` and `window.dotesSchemaMappingSources`.
* Updated Font Awesome Free to 6.7.2.
* Fixed: the dashboard counted drafts and auto-drafts as posts with schema.
* Translations come from translate.wordpress.org; the bundled language files are no longer in the package.

= 1.0.0 =
* First public release.

== Upgrade Notice ==

= 1.1.1 =
Escaping fixes in the block output.

= 1.1.0 =
Automation rules fill the schema from the post's own data and fixed values. Mappings already saved are kept.
