public function headlessRenderSiteMeta($templatePath = "", $entry = null, $forTemplate = "", $locale)
{
$renderedHTML = "";
if (!$locale) {
$locale = craft()->language;
}
/* -- If there is an entry associated with this meta render that has an SEOmatic FieldType in it, make sure it is included */
if ($entry) {
$entryMeta = craft()->seomatic->getMetaFromElement($entry);
if ($entryMeta) {
craft()->seomatic->setEntryMeta($entryMeta, "");
}
}
/* -- Get the SEOmatic globals for the current template / entry / global meta context */
$metaVars = craft()->seomatic->getGlobals($forTemplate, $locale);
/* -- Call SEOmatic to render the actual meta for us */
$renderedHTML = craft()->seomatic->renderSiteMeta($forTemplate, $metaVars, $locale);
return $renderedHTML;
}