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

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

You’ll need to manually add the Keyword.  For example, a defined Keyword called service would be added by entering {service}

Gutenberg 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: Generate Content: Using Keywords: Autocomplete List on Gutenberg Block

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.  In the above example, this means that we could use the following keywords in our Content Group:

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
First and last word transformations delineate using a space.

Apply Multiple Keyword Transformations

Up to 2 keyword transformations can be applied to a keyword.

Transformations are applied in the order they are written, from left to right.  Taking the below example, where the URL transformation will lowercase the string:

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

Extracting Term Subsets (Columns)

We can output a subset of each Term’s data by using the keyword’s defined columns.  In the above example, this means that we could use the following keywords in our Content Group:

Keyword Example Value
{location(city)} Birmingham
{location(county)} West Midlands

Keyword Transformations can also be applied to Keyword Columns.  Taking {location(city)} as an example:

Transformation Syntax Output
Uppercase {location(city):uppercase_all} BIRMINGHAM
Lowercase {location(city):lowercase_all} birmingham
Capitalise first letter {location(city):uppercase_first_character} Birmingham
Capitalise first letter of each word {location(city):uppercase_first_character_words} Birmingham
Convert to Permalink style slug {location(city):url} birmingham

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.

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