How to Generate List of MPG Pages?


One of the biggest advantages of using MPG plugin is ability to generate filtered lists of data from your Source file. This helps generating tables of factual content, in-links, etc. A most popular example would be generating a clickable list of all states in a country, or cities in a state.

To do just that, we will:

  • head over to our MPG project, and click the “Shortcode” tab at the top of the page.
  • Scroll down to “Generate list”.
  • Here we can setup the filter and criterial of the generated list. For example, if you use our “US cities” template and would like to generate a clickable list of all cities in Cuyahoga Country, in state of Ohio, you would specify the condition to be state_name = Ohio AND county_name = Cuyahoga.
  • A shortcode below will be generated which you can preview (first 4 URLs will appear).
Generate list

There are many ways customize the list by:

  • Limiting the number of generated results using “Limit” parameter.
  • Splitting results into columns or table.
  • Return results in a random order, ascending or descending using “Direction” parameter.
  • Generating Nested Lists for hierarchal content such as Country > State > City type of pages, where each project generates list of subsequent filtered results. 

List of Attributes


(required, integer) – uses project ID from which data is retrieved

Example: project-id=”2”


(optional, text or shortcode)  – uses single or multiple expressions separated by semicolon “;”.

Used to specify filter conditions of the generated list. A static text can be used such as “California” or a shortcode such as {{mpg_state}}. Regular expression syntaxis can be used in PCRE format.

Format: where=”mpg_header=value”

  • Example 1: where=”mpg_city=Springfield” – returns all rows where column  mpg_city contains value Springfield
  • Example 2: where=”mpg_city=^Ca” – returns all rows where column mpg_city contains values which start with “Сa”, such as Canberra
  • Example 3: where=”mpg_city=burgh$” – returns all rows where column mpg_city contains value which ends with “burgh”, such as Edinburgh
  • Example 4: where=”mpg_state={{mpg_state}}” – returns all rows where column mpg_city contains value equal to current value of mpg_state for given page. If user opened a page of city “San Diego”, which is in state California, then shortcode will return all rows where state = California. Therefore if user opens a page for city of “Cleveland” which is Ohio, then same shortcode will return all rows for Ohio.
  • Example 5: mpg_city=york finds all rows in which mpg_city contains “york” (as LIKE(%york%) in MySQL). Result –
  • Example 6: mpg_city=^york$ finds all rows, where cell mpg_city has an exact match with “york”. Result –


(optional, string) – available: 'or' (default) and 'and'

Used for specifying additional conditions for where. Examples:

  • Example 1: where=”mpg_city=^Ca; mpg_country=Australia” operator=”and” - all rows are select where mpg_city starts with Ca, while mpg_country in the same row is "Australia".
  • Example 2: where=”mpg_socks_size=Medium; mpg_socks_size=Large” operator=”or” - all rows are selected where mpg_socks_size is Medium or Large.


(optional, integer) – Used to limit the number of returned results. Example use: limit=”5”. If limit is more than the returned results, the returned lists won't be affected.


(optional, string) – allows specifying a column of a data source file to sort by. Used on par with 'direction' attribute.

Example 1: order-by=”mpg_city”


(optional, string) – allowed specifying one of the three sorting options: 

  • acs – for ascending sorting. Requires order-by attribute
  • desc – for descending sorting. Requires order-by attribute
  • random – randomized sorting


  • Example 1:  order-by=”mpg_city” direction=”asc” – sorts by city names from A to Z
  • Example 2:  order-by=”mpg_city” direction=”desc” – sorts by city names from Z to A
  • Example 3:  direction=”random” – randomizes returned values. After each refresh, unless cache is enabled, new order is generated.

Let your imagination run wild by creating nests of templates! You can have a template made out for countries, inside of each generated page have a generated list of states/provinces, inside have a list of generated cities, inside have a list of generated Mayors and each page contain biography on each mayor. Impressed yet?! Go and try this yourself!