Sterc / SEOPro

The ultimate MODX Revolution SEO companion
https://www.sterc.nl/en/modx-extras
14 stars 29 forks source link

seoPro.keywords placeholder is not set when empty #94

Open jgulledge19 opened 5 years ago

jgulledge19 commented 5 years ago

The [[+seoPro.keywords]] is not set when there are no keywords. Can this always be set?

Issue

When a resource is rendered and their is no value set for the seoPro.keywords, it will not allow caching in Statcache or Stockpile Static Generator

Related code

Starting around line 164 https://github.com/Sterc/SEOPro/blob/41c73883ea8803972e243f4578764673069bac48/core/components/seopro/elements/plugins/seopro.plugin.php#L164

if ($seoKeywords) {
    $keyWords = $seoKeywords->get('keywords');
    $modx->setPlaceholder('seoPro.keywords', $keyWords);
}

Could it be updated to:

$keyWords = '';
if ($seoKeywords) {
    $keyWords = $seoKeywords->get('keywords');
}
// Always set the placeholder even if it is empty
$modx->setPlaceholder('seoPro.keywords', $keyWords);