1. Home
  2. Knowledge Base
  3. SEO Suite
  4. Using Variables in the SEO Title and Description

Using Variables in the SEO Title and Description

Rank Math supports variables, and you can take advantage of this to create dynamic titles and descriptions or a mix of both static and dynamic text. Variables are nothing but containers that point to a specific value, already available in your post or page. So by referring to these existing values, you can save your time, as you don’t have to add/update the title and description manually every time when the value is changed — Rank Math would do that automatically for you.

In this knowledgebase article, we’ll walk you through how to use variables in Rank Math, and we’ll discuss all the variables that Rank Math offers.

Using Variables in Rank Math

Rank Math’s Meta Box lets you add the SEO Title and Description for your page. We have added the Meta Box on the same page where you write your content—in the post editing screen.

If you’re using Classic Editor, you’ll have to scroll down a bit to reach the Meta Box. If you’re using the Block Editor, then Rank Math’s Meta Box can be accessed by clicking the Rank Math SEO icon on the top-right corner of the page.

Click Rank Math SEO icon in the Gutenberg Editor

The first tab in the Rank Math’s Meta Box is the General tab. In the General tab, click the Edit Snippet to open the Preview Snippet Editor dialog box.

Choose Edit Snippet in General tab

The Title and Description fields in the Snippet Editor support variables, and you can access these variables by clicking the down arrow in the right corner of the field.

What Variables Are Supported

Now, let’s have a close look at each of the variables that are present in the General tab.

1 Separator Character

%sep% will add a separator to your Title and Description. It will use the Separator Character that you’ve set under Rank Math > Titles & Meta > Global Meta > Separator Character.

In the below image, you can notice the separator is being set with a pipe [ | ]. You can choose one of the available separators or set a custom one in the last field.

separator-settings-rank-math

2 Search Query

Search Query %search_query% will be available only on the search result pages. The variable will set the search query of the current page. You can set the title for the search results page in Rank Math under General Settings > Titles & Meta > Search Results Title.

Search Results Title - Rank Math Titles & Meta

3 Counter

%count(varname)% will add a counter for the variable and it starts at 1. Replace varname with your Rank Math variable for which you wish to set the counter for and then every time when the counter variable is used on the page, the counter value will increment by 1.

For example, if you’re setting the default ALT text for the images in your post with the post title and a counter, then you can use the following format.

%title% %count(title)%

4 File Name

File Name %filename% variable will display the name of your attachment file. The variable can be used only in the fields related to the attachments. For example, ALT text, title, caption and description of your images.

5 Site Title

The Site Title %sitename% variable will display the name of your website you’ve configured under WordPress Dashboard > Settings > General > Site Title.

Site Title in WordPress settings

6 Site Description

The Site Description %sitedesc% variable will display the description of your site configured under WordPress Dashboard > Settings > General > Tagline.

7 Current Date

By using the Current Date %currentdate% variable, you can display the current date in your title and description.

Current date variable example

8 Current Day

The Current Day %currentday% variable can be used for displaying the current day of the month in the title and description.

9 Current Month

The Current Month %currentmonth% variable will display the current month.

Current month variable example

10 Current Year

The Current Year %currentyear% variable will display the current year as shown below.

Current year variable example

11 Current Time

The Current Time %currenttime% variable will display the current server time.

Current time variable example

12 Current Time Advanced

Rank Math allows you to set the Current server time with a custom formatting pattern with the help of %currenttime(F jS, Y)% variable.

You can refer to the WordPress documentation to come up with the format string to use in your variable.

13 Organization Name

The %org_name% variable will retrieve the name of the organization you’ve added in the Local SEO settings.

If you haven’t already configured, you can set the Organization name by navigating to WordPress Dashboard > Rank Math > Titles & Meta > Local SEO > Name. If this section is unavailable on your website, ensure that you’ve enabled the Local SEO & Knowledge Graph module in the Rank Math Dashboard.

Organization name in Local SEO Titles & Meta settings

Organization Logo %org_logo% variable will add your organization’s logo if you’ve configured it under Rank Math > Local SEO > Logo.

Organization Logo - Local SEO settings

15 Organization URL

Organization URL %org_url% variable will add the Organization URL you’ve configured under Rank Math > General Settings > Local SEO > URL.

URL in Local SEO settings

16 Post Title

%title% variable will display the title of the current post or page.

17 Post Title of Parent Page

%parent_title% variable will display the title of the parent page of the current post or page.

18 Post Excerpt

Post Excerpt will show the excerpt of the current post. Also, this variable %excerpt%  will be auto-generated if there is no post excerpt available. 

However, the Post Excerpt variable %excerpt_only% will show the excerpt of the current post without any auto-generation. So if your current post does not have an excerpt, then %excerpt_only% will not return any value.

19 Post URL

%url% variable will display the URL of the current post or page.

20 Post Thumbnail

%post_thumbnail% variable will show the current post thumbnail (featured image).

21 Date Published

Date Published %date% variable will show the date on which you’ve published the current post or page.

%date(F, jS, Y)% variable publishes the date with the custom formatting pattern. You can refer to the WordPress documentation to come up with the format string to use in your variable.

22 Date Modified

%modified% variable will show the last modified date of the current post or page.

%modified(F, jS, Y)% variable will show the modified date with a custom formatting pattern. You can refer to the WordPress documentation to come up with the format string to use in your variable.

23 Post Category

%category% variable will display the category of the current post or the current category on the category archives.

24 Post Categories

%categories% will display a comma-separated list of categories that are associated with the current post.

25 Categories (Advanced)

%categories(limit=3 & separator = | & exclude= 12, 23)% variable will show the list of categories of the current post along with the customization options. You can include only the essential parameters in the variable for customizing the output, and here are the parameters you can make use of:

  • Limit: To set the maximum number of categories to display
  • Separator: To set the character to separate categories in the output
  • Exclude: Enter the ID of the categories to be excluded

26 Post Tag

%tag% variable will display the post tag of the current post or the current tag on the tag archives.

27 Post Tags

%tags% variable will display the comma-separated list of tags that are associated with the current post.

28 Tags (Advanced)

%tags(limit=3 & separator = | & exclude= 12, 23)% will output the list of tags associated with the current post with customization options. You can include only the essential parameters in the variable, and here are the parameters you can make use of:

  • Limit: To set the maximum number of tags to display
  • Separator: To set the character to separate tags in the output
  • Exclude: Enter the ID of the tags to be excluded

29 Current Term

Current Term %term% variable displays the name of the current term on taxonomy archive pages.

30 Term Description 

%term_description% variable will display the current term description on the taxonomy archive pages.

31 Custom Term (Advanced)

%customterm(taxonomy-name)% will display the name of the custom term in your title. Replace the taxonomy-name in the variable with your taxonomy name.

32 Custom Term Description

%customterm_desc(taxonomy-name)% displays the custom term description. Replace the taxonomy-name in the variable with your taxonomy name.

33 Author ID

%userid% variable will display the user ID of the current post or a page. The user ID of the author is the same as the one that is seen in the URL of the Edit User.

User id in WordPress

34 Post Author

Post author %name% will display the author name of the current post, page, or the author archive.

35 Author Description

%user_description% variable will display the biographical info of the author of the current post, page, or the author archive. The Biographical Info of the author is set by opening the Edit User from the Users menu in WordPress.

36 Post ID

%id% displays the ID of the current post or the page. The post ID is the same as the one that you can see in the URL of the edit screen of the post/page.

37 Focus Keyword

With the focus keyword variable %focuskw%, you can set the focus keyword of the current post or page in the title and description. In case if the post or page uses multiple focus keywords, then this variable would return only the primary focus keyword, which is indicated by a star, as shown below.

38 Focus Keywords

The %keywords% variable will display a comma-separated list of all the focus keywords of the current post or page.

39 Custom Field (Advanced)

%customfield(field-name)% shows the custom field value in the title of your post. Replace the field-name with the name of your custom field.

40 Page

%page% will help you to display the page numbers but will be displayed only on pages 2 and above.

For instance, if you’re on the third page of the archive that contains 5 pages, then the %page% variable on the third page would display,

Page 3 Of 5

41 Page Number

%pagenumber% will display the current page number.

42 Max Page

%pagetotal% variable will display the total number of pages.

43 Post Type Name Singular

%pt_single% will display the singular name of the current post type. E.g. post, page, product, etc.

44 Post Type Name Plural

%pt_plural% will display the plural name of the current post type. E.g. posts, pages, products, etc.

45 Random Word PRO

%randomword(word1|word2|word3)% variable will show the random word chosen from the list (word1|word2|word3). You can add any number of words to this list.

%randomword_np(word1|word2|word3)% will show a different word from the list in random, every time the page is loaded.

Note: If you’re running an automated blog, then you can take advantage of the random word variable to use Spintax in your meta title and description.

46 Group Name

%group_name% will display the name of the current BuddyPress group. This variable is available to use only if your website uses BuddyPress.

47 Group Description

%group_desc% will display the description of the current BuddyPress group. This variable is available to use only if your website uses BuddyPress.

48 Product’s Price

%wc_price% variable will display the price of the current WooCommerce product. You can set the price in your WooCommerce product page by navigating to the General tab of the Product data section. In case if you have an active sale running, then Rank Math will consider the Sale price for this variable, else the Regular price will be used.

WooCommerce Product price

49 Product’s SKU

%wc_sku% variable will display the Stock Keeping Unit (SKU) of the current WooCommerce product. The SKU can be added to the WooCommerce product page by navigating to the Inventory tab under the Product data section, as shown below.

WooCommerce product SKU

50 Product’s Short Description

%wc_shortdesc% variable will display a short description of the current WooCommerce product. To edit the Product short description, open the WooCommerce product page and then edit the Product short description field.

51 Product’s Brand

%wc_brand% variable will display the brand of the current WooCommerce product. Rank Math lets you set the brand names to WooCommerce taxonomies or a custom brand name, if all your products belong to the same brand. To do so, navigate to Rank Math > General Settings > WooCommerce and choose an option for Select Brand.

If you choose custom, another option would appear below to let you add a custom brand name.

Select Brand - WooCommerce settings

52 Image Alt PRO

The %imagealt% variable will display the alt text set for the current image.

53 Image Title PRO

The %imagetitle% variable can be used to display the title of the current image.

You can use these variables in the global settings for Titles & Meta as well if you do not wish to use them on individual posts/pages/products every time you create new content.

And, that’s it! We hope the article was helpful in understanding the variables available in Rank Math. In fact, you can take advantage of our filter to create variables of your choice and use them inside your posts. If you still have absolutely any questions on using Rank Math, please feel free to reach our support team directly from here, and we’re always here to help.

Was this article helpful?

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket

Related Articles