Adding Recipe Schema for Rich Snippets
Adding Schema.org Recipe and Guided Recipe metadata to your blog posts, pages, products, and collections in Shopify can improve how your page shows up in Google’s organic results.
Just have a look at Cooking Panda's Rich Results in Google Search and Google Image Search.
JSON-LD for SEO supports both the recipe type and guided recipes once you add some additional data to your page. This will need to be done for each page you’d like to show up as a recipe.
The example below uses a blog post but recipes can be added to different areas of Shopify such as blog posts, pages, collections, products, etc.
Add metafields
There are two ways to add metafields to Shopify as of mid-2022.
- The first is using your metafield tool of choice.
- The second is to use Shopify’s native metafield tool. I found this to be a bit easier because I’m only creating the metafield once, then assigning values to each recipe.
Whatever you choose is fine. Once you decide how (app or Shopify) add the following fields to pages, blog posts, etc under the jsonld
namespace.
- namespace:
jsonld
- key:
recipeCategory
- type:
string
(single-line text)
The only required field is the recipeCategory
but the others are highly recommended as Google will use that data in their analysis and Rich Results.
-
recipeCategory
– (required) the category for the recipe. -
cookTime
– how long it takes to cook the recipe. This must be in the ISO 8601 duration format. e.g. 90 minutes would bePT90M
orPT1H30M
-
prepTime
– how long it takes to cook the recipe. This must be in the ISO 8601 duration format. e.g. 90 minutes would bePT90M
orPT1H30M
-
totalTime
– how long it takes to cook the recipe. This must be in the ISO 8601 duration format. e.g. 90 minutes would bePT90M
orPT1H30M
-
calories
– number of calories in the recipe -
recipeIngredient
– the list of ingredients used in the recipe, separated by a semi-colon (;) -
recipeInstructions
– the step-by-step instructions for the recipe, separated by a semi-colon (;) -
recipeCuisine
– the region associated with your recipe. e.g. American, French, Mediterranean. -
keywords
– other descriptive terms for your recipe, separated by a comma (,). Don’t use the ones you added to the recipeCategory or recipeCuisine. -
recipeYield
– the quantity produced by the recipe. Use only a number so you can qualify for the Guided Recipes markup. If you want to include additional yields or yields with text, you can use commas for each yield. E.g.12, 1 large punch bowl, 64 oz
will result in using the 12 for Guided Recipes, and will list the 1 large punch bowl and 64oz as other yields. -
recipeVideo
– the ID of the structured data VideoObject for the recipe.
The following data is optional. If you don’t enter it into a metafield, JSON-LD for SEO will use the default values from your Blog Post or Page.
-
name
– recipe name, this will default to the name of the blog post or page title -
description
– description of the recipe, this will default to the blog post description -
author
– recipe author; for blogs, this will default to the blog post author and pages will default to the store. -
author_url
– recipe author URL; for blogs and pages, this will default to the store URL. The metafield can be set store wide and/or at the page level. -
image
– image for the recipe, this will default to the blog post’s featured image
Example of what to enter using the metafields app
Example of what to enter using Shopify’s native metafields tool
Assign values to your newly created metafields
Then, you’ll want to add the values to your recipe. Go to your page, blog posts, etc, and scroll to the bottom. You’ll see a spot for Metafields. Select Show All to add the values. The end result may look something like this:
Testing the Recipe Schema
Once these metafields have been created and saved for the blog post, you can use Schema Markup Validator to verify the data is correct.
It will take some time before Google updates its results to include your recipe Rich Snippet.
You can see a demo of what this looks like on the JSON-LD for SEO demo site.
JSON-LD for SEO
Get more organic search traffic from Google without having to fight for better rankings by utilizing search enhancements called Rich Results.