Blog Categories

Wednesday 30 September 2015 |
Tips, SEO

CGBlog CMSMS adding SEO Titles to Posts

How to improve the SEO of CGBlog by creating post specific SEO titles.

Tested this on:

  • cms made simple version 1.12 pohnpei including the following module versions: cgblog 1.12.10
  • cgextensions 1.49.6
  • cgsimplesmarty 1.9.1
  • jquerytools 1.3.6

Step 1

create a user defined tag called blog_cat_page_title and add this code to it:

$db = cmsms()->GetDb();

$query = "SELECT name FROM " . cms_db_prefix() . "module_cgblog_categories WHERE id = ".$params['category_id'];

$row = $db->GetRow($query);

if ($row) { $smarty->assign('blogtitle',$row['name']); }

Step 2

Add this code to the beginning of your cgblog summary template:

{blog_cat_page_title category_id=$actionparams['category_id']}

step 3

In the page layout template used to display your cgblog summaries, within the head tag, if you are using the default cmsms template code for your page title:

<title>{sitename} - {title}</title>

replace it with:

<title>{if isset($blogtitle)}{$blogtitle}{else}{title}{/if}</title>

but if you are already using your own code within the <title> tag and don't want to overwrite what you have, you will need to work this into your existing code

{if isset($blogtitle)}{$blogtitle}{else}{title}{/if} or something similar to make use of the $blogtitle variable if it has been set.

We have had some great success with this setting, let us know how you get on.

tag and don't want to overwrite what you have, you will need to work this into your existing code {if isset($blogtitle)}{$blogtitle}{else}{title}{/if} or something similar to make use of the $blogtitle variable if it has been set.

Subscribe to SEO Blog

Enter your email address:

Delivered by FeedBurner