View Full Version : Modifying auto generated Blog <title> and og:description tags
DetroitYES
09-25-2012, 06:52 PM
I have a blog setup for a client, and they would like both the Forum name and Username removed from the Blog entry's title and facebook meta tags for SEO purposes.
This seems like something I could *probably* do with a plugin... can anyone offer insight on this as far as how and where the titles get generated?
Thanks.
It looks like the keywords and description are set in a plugin ousing hook global_state_check (that's part of the blocg product). The code looks like this:
if ($vbulletin->GPC['blogid'] AND $GLOBALS['bloginfo'] = verify_blog($vbulletin->GPC['blogid'], false, false))
{
$GLOBALS['blogid'] =& $GLOBALS['bloginfo']['blogid'];
$vbulletin->options['keywords'] = ($GLOBALS['bloginfo']['taglist'] ? $GLOBALS['bloginfo']['taglist'] . ', ' : '') . $GLOBALS['bloginfo']['title'] . ', ' . $vbulletin->options['keywords'];
$vbulletin->options['description'] = $GLOBALS['bloginfo']['title'] . ' ' . $GLOBALS['bloginfo']['blog_title'];
}
So it might work if you were to create your own plugin using that hook, and set the execution order to something > 5 to make sure it runs after the existing plugin. Then do something like:
if ($vbulletin->GPC['blogid'] AND $GLOBALS['bloginfo'])
{
$vbulletin->options['keywords'] = ''; // of course you can set these to whatever you want instead of a blank string
$vbulletin->options['description'] = '';
}
DetroitYES
10-16-2012, 09:35 PM
Okay here is what I ended up with:
hooked at global_state_check, this will pull from the blog text and feed it into the meta description/ og:description
if ($vbulletin->GPC['blogid'] AND $GLOBALS['bloginfo'])
{
$atdcbs_description = $vbulletin->db->query_first("SELECT " . TABLE_PREFIX . "blog_text.pagetext FROM " . TABLE_PREFIX . "blog_text WHERE " . TABLE_PREFIX . "blog_text.blogid = ".$vbulletin->GPC['blogid']);
$atdcbs_description = preg_replace("/\[[^)]+\]/","",$atdcbs_description['pagetext']);
$atdcbs_description = strip_tags($atdcbs_description);
$atdcbs_description = substr($atdcbs_description, 0 ,300)."...";
$atdcbs_description = htmlspecialchars($atdcbs_description, ENT_QUOTES);
$vbulletin->options['description'] = $atdcbs_description;
}
hooked at fb_opengraph_array, this will remove the site name from the title when liking on facebook (I thought it was a bit redundant)...
if (VB_PRODUCT == 'vbblog') {
unset($og_array['og:site_name']);
}
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.