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.
You can find the relevant options in the Search appearance section of the Yoast SEO plugin. There you’ll find loads of options for setting variables to automate your SEO efforts. The full list of variables is listed on the HELP tab of the plugin. Just go to SEO → Search Appearance and click the Need help button in the top left. Then choose the tab ‘template explanation’ and then “snippet variables”. Here you’ll see the list of variables you can use. You can also check our knowledge base article on Snippet variables.
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. 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.
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 title 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.
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 »