Generate: Using Keywords

Overview

Your defined Keywords can be used in any editable text field or Page Builder on a Content Group or Term Group.

Page Generator Pro can’t replace Keywords defined in a Template or Global Element derived from e.g. a Page Builder, as these are typically global items, where changing a Keyword for a Term would affect all Pages, Posts and Custom Post Types inheriting said Template / Global Element.

When generating content, Page Generator Pro will replace these keywords with actual terms specified in the keywords.  For example, if our {service} keyword comprises of Web Design and Web Development, the Plugin would generate at least two Pages:

  1. Web Design in…
  2. Web Development in…

Depending on the field you’re editing, and the editor experience you’re using, you can add keywords to your content in a number of ways:

Insert Keyword Dropdown

The Insert Keyword dropdown option is displayed on some fields in the Classic Editor, such as the Title and Excerpt:
Page Generator Pro: Generate: Keyword Dropdown

If you are not using the Classic Editor Plugin (i.e. you are using Gutenberg/the block editor, or a Page Builder), refer to the below sections, which cover using Keywords for those accordingly.

Don’t see the Keyword Dropdown? You must define at least one Keyword first, and will only see a dropdown above the title field if the Classic Editor Plugin is activated.

Autocomplete Suggestions

For most fields, an autocomplete dropdown list of matching Keywords will be displayed when you begin typing with a left curly brace.

Continue to type until you see the keyword you want to insert, and either:

  • Click the keyword,
  • Use the arrow keys on the keyboard to navigate up and down the autocomplete list, highlighting the required Keyword and pressing the Enter key

For example, to add a defined Keyword called service:

  • Start typing {ser,
  • Click the resulting keyword in the list:
    Page Generator Pro: Generate Content: Using Keywords: Autocomplete List on Field

To hide or cancel autocompletion, either press the escape key, or click outside of the list of suggested keywords.

No autocomplete list displaying? You must define at least one Keyword first.
The autocomplete suggestions list will work with most third party Plugins, however it is not always possible to include integration. In those cases, simply type the full Keyword required into the necessary field of the third party Plugin or Page Builder.

Gutenberg Title and Blocks

An autocomplete dropdown list of matching Keywords will be displayed when you begin typing with a left curly brace.

Continue to type until you see the keyword you want to insert, and either:

  • Click the keyword,
  • Use the arrow keys on the keyboard to navigate up and down the autocomplete list, highlighting the required Keyword and pressing the Enter key

For example, to add a defined Keyword called service:

  • Start typing {ser,
  • Click the resulting keyword in the list:
    Page Generator Pro: Content Groups: Gutenberg Title Autocomplete

To hide or cancel autocompletion, either press the escape key, or click outside of the list of suggested keywords.

No autocomplete list displaying? You must define at least one Keyword first.

Classic / Visual / TinyMCE Editor

An autocomplete dropdown list of matching Keywords will be displayed when you begin typing with a left curly brace.

Continue to type until you see the keyword you want to insert, and either:

  • Click the keyword,
  • Use the arrow keys on the keyboard to navigate up and down the autocomplete list, highlighting the required Keyword and pressing the Enter key

For example, to add a defined Keyword called service:

  • Start typing {ser,
  • Click the resulting keyword in the list:
    Page Generator Pro: Generate Content: Using Keywords: Autocomplete List on TinyMCE

To hide or cancel autocompletion, either press the escape key, or click outside of the list of suggested keywords.

No autocomplete list displaying? You must define at least one Keyword first.
Entering keywords manually into Visual Editors or Page Builders? Make sure that the keyword is pasted as plain text.  You can confirm this by going into the HTML view of most Visual Editors or Page Builders, and confirming that the keyword appears as plain text e.g. {keyword}, not wrapped in HTML tags e.g. <span>{</span>keyword<span>}</span>
Using a Page Builder? Whilst every best effort is made to register the autocomplete suggestions list, it might not display for all Page Builders. You’ll therefore need to manually type in the Keyword.

Transforming Keywords

Assuming you have the following example Keyword configured:

Setting Value
Keyword location
Terms Birmingham, West Midlands
Harborne, West Midlands
Selly Oak, West Midlands
Delimiter ,
Columns city, county

The output of keyword terms can be transformed, by using a flag after the keyword.  For example:

  • {location:uppercase_all} would convert Birmingham, West Midlands to BIRMINGHAM, WEST MIDLANDS.
  • {location(city):lowercase_all} would convert Birmingham to birmingham

Some Keyword Transformations also support arguments, which are defined in square brackets.  For example:

  • {location(city):random[2,4]} would choose between two and four Terms at random, outputting them in a random order as a comma separated list.

Multiple Transformations

Multiple transformations can be applied to a Keyword, and are applied in the order they are written, from left to right.  For example:

Transformation Syntax Output
Uppercase and Convert to Permalink style slug {location:uppercase_all:url} birmingham-west-midlands
Convert to Permalink style slug and Uppercase {location:url:uppercase_all} BIRMINGHAM-WEST-MIDLANDS

The below sections detail the available Keyword Transformations.

Character Transformations

First and last word transformations delineate using a space.
Transformation Syntax Output
Uppercase {location:uppercase_all} BIRMINGHAM, WEST MIDLANDS
Lowercase {location:lowercase_all} birmingham, west midlands
Capitalise first letter {location:uppercase_first_character} Birmingham, west midlands
Capitalise first letter of each word {location:uppercase_first_character_words} Birmingham, West Midlands
First word {location:first_word} Birmingham
Last word {location:last_word} Midlands
Convert to Permalink style slug {location:url} birmingham-west-midlands
Convert to Permalink style slug, underscores {location:url_underscore} birmingham_west_midlands
Transformation Syntax Output
Convert to Permalink style slug {location:url} birmingham-west-midlands
Convert to Permalink style slug, underscores {location:url_underscore} birmingham_west_midlands

Force Keyword Term

The output of the keyword can be forced to always output a specific term.  In the above example, this means that we could use the following keywords in our Content Group:

Transformation Syntax Output
Force Specific Term {location:3} Selly Oak, West Midlands
Force Specific Term, City Column {location(city):3} Selly Oak

Output All Terms

The output of the keyword can be forced to always output all terms, in a comma separated list.  In the above example, this means that we could use the following keywords in our Content Group:

Transformation Syntax Output
Output All Terms {location:all} Birmingham, West Midlands, Harborne, West Midlands, Selly Oak, West Midlands
Output All Terms, City Column {location(city):all} Birmingham, Harborne, Selly Oak

Output Same Random Term

The output of the keyword can be set to output the same term, chosen at random.  In the above example, this means that we could use the following keywords in our Content Group:

Transformation Syntax Output
Output Random Term {location:random} Selly Oak, West Midlands
Output Random Term, City Column {location(city):random} Birmingham
This will output the same random term across all occurrences of the specified keyword.  In our example, using {location:random} a second time would again output the same random term (Selly Oak, West Midlands)

Output Same Random Terms in a List

This functionality is available in Page Generator Pro 3.3.1, releasing Thursday 8th July 2020 23:59 UTC

The output of the keyword can be set to output the same list of terms, chosen at random, in a comma separated format, based on the arguments provided in square brackets.  In the above example, this means that we could use the following keywords in our Content Group:

Transformation Syntax Output
Output 2 x Random Terms, City Column {location(city):random[2]} Selly Oak, Birmingham
This will output the same random terms list across all occurrences of the specified keyword.  In our example, using {location(city):random[2]} a second time would again output the same random terms list (Selly Oak, Birmingham)

Output Different Random Term

The output of the keyword can be set to output a different term, chosen at random for each occurrence of the Keyword.  In the above example, this means that we could use the following keywords in our Content Group:

Transformation Syntax Output
Output Random Term {location:random_different} Selly Oak, West Midlands
Output Random Term, City Column {location(city):random_different} Birmingham
This will output a different random term for each occurrence of the specified keyword.  In our example, using {location:random_different} a second time would output a different random term (e.g. Birmingham, West Midlands)

Output Random Term Subsets in a List

Outputting Random Term Subsets functionality is available in Page Generator Pro 3.4.0, releasing Thursday 2nd September 2021 23:59 UTC

Assuming you have the following example Keyword configured:

Setting Value
Keyword location
Terms Birmingham,West Midlands,”Granville Street,New Street,Lombard Street,Hagley Road,Bristol Road,Milner Road”
Edgbaston,West Midlands,”Woodbourne Road, Augusta Road, Farquar Road,Edgbaston Street,Ryland Road”
Delimiter ,
Columns city_name,region,street_names

Instead of using {location(street_names)} to output the list of Street Names, we can use the Random Term Subsets transformation to output a subset of the Street Names, in a random order, based on the supplied comma separated list of arguments provided in square brackets:

Argument Description Example
Minimum Number of Term Subsets The minimum number of Term Subsets to output 2
Maximum Number of Term Subsets The maximum number of Term Subsets to output 4
The Terms must be separated by a comma.

In the above example, this means that we could use the following keywords in our Content Group, producing the Output based on the first term, Birmingham:

Transformation Syntax Output
Output between 2 and 4 Street Names {location(street_names):random_subset[2,4]} Hagley Road, New Street
Output 3 Street Names {location(street_names):random_subset[3]} Bristol Road, Milner Road, New Street

Output Nearby Terms in a List

Outputting Nearby Terms functionality is available in Page Generator Pro 3.3.1, releasing Thursday 8th July 2021 23:59 UTC

Assuming you have the following example Keyword configured:

Setting Value
Keyword location
Terms Birmingham, 52.480000, -1.902500, West Midlands
Harborne, 52.459999, -1.950000, West Midlands
Selly Oak, 52.438660, -1.941110, West Midlands
Delimiter ,
Columns city_name, city_latitude, city_longitude, county_name

When using a Keyword, comprising of location names, latitudes and longitudes, the output of the Keyword can be set to list nearby locations in a comma separated list, based on the supplied comma separated list of arguments provided in square brackets:

Argument Description Example
Latitude Column Name The name of the column holding the latitude for the given Keyword that is being transformed. city_latitude
Longitude Column Name The name of the column holding the longitude for the given Keyword that is being transformed. city_longitude
Radius The number of miles to restrict results to, based on the current Term 3
Order Terms By Distance Whether to order the output of Terms by distance 1: Order by Distance
0: No order
A column name must be specified on the Keyword.
The Keyword must contain latitude and longitude data.

In the above example, this means that we could use the following keywords in our Content Group, producing the Output based on the first term, Birmingham:

Transformation Syntax Output
Output Nearby City Names within a 5 mile Radius, ordered by Distance {location(city_name):nearby[city_latitude,city_longitude,5,1]} Harborne, Selly Oak
Output Nearby City Names within a 3 mile Radius, no ordering {location(city_name):nearby[city_latitude,city_longitude,3]} Harborne
* Here, ‘Selly Oak’ is 3.2 miles from Birmingham, and therefore is not output.

Number to Words Transformations

This functionality is available in Page Generator Pro 3.5.5, releasing Thursday 13th January 2022 23:59 UTC

Assuming you have the following example Keyword configured:

Setting Value
Keyword number
Terms 1
2
3

Unless an argument is specified, output will be attempted in the WordPress Site’s Language.

Transformation Syntax Output
Convert Number to Word (English) {number:number_to_words} one
Convert Number to Word in Brazilian Portuguese {number:number_to_words[pt_BR]} um

Transformations can also be applied to a Keyword’s Column; in this case, the numeric column name:

Setting Value
Keyword number
Terms 1, one item
2, two items
3, three items
Delimiter ,
Columns numeric, text

Unless an argument is specified, output will be attempted in the WordPress Site’s Language.

Transformation Syntax Output
Convert Number to Word (English) {number(numeric):number_to_words} one
Convert Number to Word in Brazilian Portuguese {number(numeric):number_to_words[pt_BR]} um
Refer to this table for a list of supported country codes. You may need to explicitly specify a language code if your WordPress Site’s Language has not been detected.
The value must be numerical.  Use of decimal place will be ignored, for example 1,500.10 would output one thousand five hundred.

Currency to Words Transformations

This functionality is available in Page Generator Pro 3.5.5, releasing Thursday 13th January 2022 23:59 UTC

Assuming you have the following example Keyword configured:

Setting Value
Keyword price
Terms 3.99
2.50
1

Unless an argument is specified, output will be attempted in the WordPress Site’s Language, US Dollars.

Transformation Syntax Output
Convert Currency to Words (English, US Dollars) {price:currency_to_words} three dollars ninety-nine cents
Convert Currency to Words in Brazilian Portuguese (US Dollars) {price:currency_to_words[pt_BR]} três dólares e noventa e nove centavos
Convert Currency to Words in Brazilian Portuguese in Brazilian Real Currency {price:currency_to_words[pt_BR,BRL]} três reais e noventa e nove centavos

Transformations can also be applied to a Keyword’s Column; in this case, the numeric column name:

Setting Value
Keyword price
Terms 3.99, “item costs 3.99”
2.50, “item costs 2.50”
1, “item costs 1.00”
Delimiter ,
Columns numeric, text

Unless an argument is specified, output will be attempted in the WordPress Site’s Language.

Transformation Syntax Output
Convert Currency to Words (English, US Dollars) {price(numeric):currency_to_words} three dollars ninety-nine cents
Convert Currency to Words in Brazilian Portuguese (US Dollars) {price(numeric):currency_to_words[pt_BR]} três dólares e noventa e nove centavos
Convert Currency to Words in Brazilian Portuguese in Brazilian Real Currency {price(numeric):currency_to_words[pt_BR,BRL]} três reais e noventa e nove centavos
Refer to this table for a list of supported country and currency codes. You may need to explicitly specify a language code if your WordPress Site’s Language has not been detected.

Combining Column Names, Transformations and Forcing Term

Any combination of the above Using Keywords sections can be used.  For example:

Transformation Syntax Output
Output City Name, Uppercase {location(city):uppercase_all} BIRMINGHAM
Output 3rd City Name, Lowercase {location(city):3:lowercase_all} selly oak

Using Taxonomy Keywords in Groups

Any Taxonomy can also be used as a Keyword, by inserting the {taxonomy_name} tag into your content (where name is replaced by the name of your Taxonomy).  For example, if you have Categories defined on your WordPress web site (typically found at Posts > Categories), you’d use :
Page Generator Pro: Generate: Content: Taxonomy Keywords

It’s best to think of Taxonomies as predefined Keywords.  Your Taxonomy Terms are the equivalent of a Keyword’s Terms

You can insert Taxonomy Keywords manually into any content-based text field, even if the Insert Keyword dropdown isn’t present.  For example:

  • Title
  • Permalink
  • Content
  • Excerpt
  • Custom Fields
    • Meta Key
    • Meta Value

Common Issues

URLs stored in Keyword lose colon on Generation

Specifying a Keyword as the link source in Gutenberg will result in Gutenberg attempting to perform validation on the Keyword.  This results in:

  • Gutenberg prepending this automatically when it believes the string provided isn’t a URL (i.e. a Keyword),
  • The link in the generated Page will be missing a colon.

It’s therefore recommended to either:

  • Remove http(s):// from links in your Keyword, or
  • Use the Classic Editor block for that specific content section