Yeo, sup?

GetSimple News Manager Title Tags

Google webmasters tools has been complaining to me that I have duplicate title tags on this site.

Google webmasters tools duplicate title tags

Whilst probably not a massive problem, I thought it better to change. The problem is my news manager plugin. Every new post I make is not actually given its own page. When you click on one of the articles you are actually just given the homepage again with a GET request being used to find and display the content. A mod_rewrite is then used to mask this and give out a "pretty URL." With the CMS and theme the title is always just the page name. Which defaulted to "The latest news from babybean!" for all the blog posts. Fixing this is easy, or would have been if I aunderstood how the CMS works at all. What I have is one way of doing it. It may not be a very efficent way of doing things. What I have done is added this function to the "functions.php" page in the "inc" directory of the news manager.

function nm_get_title($slug, $excerpt=false) {
  $file = NMPOSTPATH . "$slug.xml";
  $post = @getXML($file);
  if (!empty($post) && $post->private != 'Y') {
    $title   = strip_tags(strip_decode($post->title));
       return $title;
  }

This was just taken from the function which generaets the article in "site.php" in the same directory. I then use an "if" statement in the theme to call the function for the title if it is a news manager page, or just use the normal output if not which looks a bit like this:

  <title><?php
   if (isset($_GET['post'])) {
     echo nm_get_title($_GET['post']) . ' - '; get_site_name();
   } else {
       get_page_clean_title(); echo ' - '; get_site_name();
   } ?></title>

I dont think that this is a huge security issue or resource hog but you never know. I will update this is this becomes a problem. Hope this helps someone.

<< Go back to the previous page