How to add Meta Title & Meta Description for MPG-Generated Pages Using an SEO Plugin
When generating dynamic pages with Multiple Pages Generator, you can automatically create unique SEO titles and meta descriptions for each page by using an SEO plugin together with MPG shortcodes.
Every generated page then has optimized metadata based on the values in your MPG source file (CSV or Google Sheet).
In this article
Requirements
Before you begin, make sure you have:
- An SEO plugin like Yoast or RankMath installed and activated. This guide uses the Yoast SEO plugin.
- An MPG project set up
- A source file with the columns you want to use for dynamic metadata
Step-by-Step Instructions
Edit the page or post that you use as the Template for your MPG project.
Scroll down to the Yoast SEO panel.
Inside Yoast’s SEO title field, enter your preferred title structure and insert MPG placeholders wherever you want dynamic data. For example:
{{mpg_city}} – Affordable {{mpg_service}} | Company Name
If your CSV or Google Sheet contains:
City Service London Plumbing Bristol Heating Repair Yoast outputs dynamic titles like:
- London – Affordable Plumbing | Company Name
- Bristol – Heating Repair | Company Name
Edit the Meta description field inside Yoast and add your desired text along with MPG shortcodes like this: Get professional {{mpg_service}} services in {{mpg_city}}. Contact us for reliable and affordable assistance today!

Click Update to save the template.
MPG now uses these Yoast SEO values when generating the dynamic URL pages.
Troubleshooting: Yoast outputs the default title instead of MPG values
If Yoast shows the default page title (or still shows {{mpg_city}}-style placeholders) on generated URLs, Yoast is usually reading the title before MPG finishes replacing the placeholders for that request.
This is why placeholders can still work inside page content, but the final Yoast SEO title can fall back to the template/default value.
PHP workaround for Yoast title output
❗ Important: Back up your site before editing PHP. Add this snippet in your child theme’s functions.php file or with a site-specific snippets plugin.
<?php
$mpg_project_id = 123; // Replace with your MPG project ID.
$mpg_project_path = '/services/'; // Replace with your MPG project URL base path.
add_filter(
'wpseo_title',
function( $title ) use ( $mpg_project_id, $mpg_project_path ) {
if ( ! class_exists( 'MPG_CoreModel' ) ) {
return $title;
}
if ( false === strpos( $title, '{{mpg_' ) ) {
return $title;
}
$request_path = isset( $_SERVER['REQUEST_URI'] )
? wp_parse_url( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), PHP_URL_PATH )
: '';
if ( ! is_string( $request_path ) || 0 !== strpos( trailingslashit( $request_path ), trailingslashit( $mpg_project_path ) ) ) {
return $title;
}
return MPG_CoreModel::mpg_shortcode_replacer( $title, $mpg_project_id );
},
99
);Replace 123 with your MPG project ID, and replace /services/ with the base URL path used by that MPG project.
Verify the dynamic title
- Open one MPG-generated URL in an incognito/private browser window.
- Inspect the browser tab title or view page source and locate the final
<title>output. - Confirm you see real row values (for example, London) instead of {{mpg_city}} placeholders or the default template title.
Yoast fields that are not processed
MPG placeholders are intended for Yoast’s SEO title and Meta description fields.
Yoast Premium’s Focus keyphrase/focus keyword fields are not currently processed by MPG placeholders.
