Schema templates and custom fields
Write schema once and apply it to every matching post with display conditions, filled from ACF, Meta Box, Pods or ACPT fields with %cf% variables.
On this page
RankKit SEO Pro This feature is part of RankKit SEO Pro. Start a 14-day free trial or see plans.
A schema template is schema written once and added to every page that matches its conditions. For example: Recipe schema on every post in the Recipes category, with the ingredients read from an ACF field. It saves you from adding the same item in the Schema manager on hundreds of posts, and new posts get it automatically.
Create a template
- Go to RankKit SEO → Schema and find the Schema templates card.
- Click New template.
- Enter a Name (for example "Recipe schema for recipes") and leave Active on.
- Set the Display conditions (below).
- Under Schema items, add one or more items. They work like the items in the Schema manager, with the same types, fields and variables.
- Click Save template.
If an item has errors, you see "Template saved. Some items have errors and will not be output." Fix the missing required fields and save again.
Display conditions
All conditions you set must match; any value within one condition matches. With no conditions, the template applies to every post and page.
| Condition | What it matches |
|---|---|
| Post types | Posts of the chosen content types. |
| Categories, tags and terms | Posts in any of the chosen terms. |
| Only these post IDs | Just these posts. |
| Never on these post IDs | Excludes these posts, even if everything else matches. |
| URL patterns (one per line) | Paths with * wildcards, such as /recipes/*, or a regular expression between # signs. A template with only URL patterns also works on archives. |
Open Which pages match? to see how many published posts the conditions cover before you save.
Example
Post types Posts plus the term Recipes means: posts in the Recipes category. Adding a URL pattern of /recipes/* as well narrows it further, since every condition must match.
Fill fields from custom fields
Use %cf:field_name% in any schema field to insert a custom field value of the current post. RankKit SEO reads:
- Advanced Custom Fields (ACF)
- Meta Box
- Pods
- ACPT, addressed as
%cf:box_name/field_name% - plain post meta keys, when none of these plugins is active
The template editor lists the custom field plugins it detected under Custom fields you can use. %cf: variables also work in the per-page Schema manager.
Ingredients (one per line): %cf:ingredients%
Cook time (e.g. PT1H): %cf:cook_time%
Calories per serving: %cf:calories%
How templates combine with page schema
- Template items are added after the page's own items. In the Schema manager and the validator they are marked from a template.
- The same rules apply as for page items: items with errors are not output, and an FAQ or How-to item is skipped if the page already has that schema from a block.
- To check a page, use the schema validator on RankKit SEO → Schema. It shows template items together with everything else the page outputs.
Templates are stored as a private post type, and every save goes through the Change Log, so you can revert a template change.
FAQ
What happens to templates if my Pro license expires?
Templates and %cf: variables are Pro features, so they stop being applied. The schema you added per page in the Schema manager stays, because the Schema manager is free.
Can a template replace the automatic Article schema?
Yes. An Article, Blog post or News article item in a template replaces the page's automatic article node, just like the same item added on the page.
Do templates work on category or archive pages?
Only templates whose conditions are URL patterns alone. Templates with post type, term or post ID conditions apply to single posts and pages.
Was this page helpful?
Related guides
Add and edit schema on a page
Use the Schema manager to add Recipe, Event, Product, FAQ, Job posting and other schema to a page, with every type and field explained.
Check and import schema
Validate the final JSON-LD a page outputs, fix errors before Google sees them, and import schema from another page's URL or from pasted code.
The Change Log: history and undo
Every SEO change in RankKit SEO is logged with before and after values and who made it. Approve agent edits, and revert one change or a whole batch.
Still need help?
Email us with your WordPress and RankKit SEO versions and what you tried. Pro customers get priority replies.