Snippet variables have become a staple of Yoast SEO. These variables make it possible to automate certain processes on your site. They also make it easy to change large batches of meta descriptions for instance, since you only have to change the structure of the variable – the site fills in the data automatically. Here, we’ll take a closer look at the snippet variables in Yoast SEO.
What is a snippet variable?
First things first: a variable is a name or a symbol that stands for a value. For instance, Yoast SEO uses the variable
Sitename to get the site name from the site itself. This way, you, as a user, don’t have to type in this information by hand. Now, when the name of the site changes, the variable automatically gets the new name from the site. If you had this hard-coded in your site, you’d have to change everything manually – everywhere. Consider doing this on hundreds of pages and you’ll start to see how powerful variables are.
How does Yoast SEO use variables?
Yoast SEO uses variables to give you the freedom and flexibility you need when working on your SEO. It makes it much easier to find a common ground for your text fields. What’s more, if you ever need to change something, variables let you do this as quickly as possible.
In this article, you’ll find the list of snippet variables you can use.
You are free to change any of the settings as you see fit, but remember, the default settings are almost always a great fit for any site. That being said, you can set variables for:
- Site title
- Custom types
How to set variables in Yoast SEO
You can use variables in a multitude of ways. Most site owners only use the most basic ones, while someone more at home in SEO might use the advanced ones. There are even variables for use with WooCommerce, so you can automatically extract product information from your store to use in the metadata. You can find an overview of all the available snippet variable types in this list. In this post, we’ll keep it simple and give a small example.
If you want to use the variables to automatically generate, for instance, SEO titles and meta descriptions for your posts, you go to ‘Search Appearance’ –> ‘Content Types’ and change the template for Posts:
You’ll see the field for titles is already pre-populated, but you can change it to whatever you feel what fits your goal. Check this article for a step-by-step explanation of how to modify default snippet templates in Yoast SEO.
If you want, you can also edit the SEO title per single post in the snippet editor of Yoast SEO. There, you’ll find the title according to the variables you’ve chosen above. In addition, you also get the option to override that title with a custom-made variant if you think that’ll attract more clicks in the search engines. The default variable string is:
Which, for the post you are now reading, leads to:
These variables combined form the SEO title of the post. In this string, the title takes the title of the post, adds a page number if any (f.i. page 3 of 4), the separator symbol you picked and the site name of the site it’s posted on. If you prefer another symbol, you can always change the title separator in the Search Appearance settings of Yoast SEO.
With the plus in the upper right corner you can add lots of other variables in there, but remember, you’re working with limited space for the snippets. If you’d add a
category, for instance, the title would become too long and Google would cut it off. Try to find a middle ground between readability, findability and branding. Yes, your branding is important, so don’t omit
Using variables for SEO
Yoast SEO supports a wide range of variables and they can be used for almost any situation. You should, however, always ask yourself if the change you want to make improves your metadata. If not, why not let the default settings do their work? Experienced SEOs will enjoy using the advanced variables and online store owners can make use of the extra WooCommerce variables. For the rest of you? Don’t overdo it.
Read more: Why every website needs Yoast SEO »
Become a Yoast SEO pro series
Coming up next!
- Event September 29, 2023 Team Yoast is at Attending WordPress Community Day – Rome 2023! Click through to see who will be there, what we will do, and more! See where you can find us next »
- SEO webinar 03 October 2023 Learn how to start your SEO journey the right way with our free webinar. Get practical tips and answers to all your questions in the live Q&A! All Yoast SEO webinars »