Optimising for a keyword

27 August 2009

Each page of your website should be optimised for something different.

Your home page would usually be optimised for your company/organisations name, then sub pages should be optimised for the purpose of that page.

Each page should have a different title and page description and these should be very relevant as the title is one of the best methods of optimising for search engines.

<h1>, <h2>, <h3> tags on every page - optimising for the correct terms.

<h1> should show the most important text, and therefore will be the biggest on the page.

<h2> is usually for sub headings down a page, and are very important, just not as much as the <h1> tag.

<h3> is more important the bold text, but not as important as the <h2> tag.

Meta keywords and meta description should both be in place, even if the meta kewords aren't so important to search engines these days.

Page text should be keyword/keyphrase rich (but not over doing it).

Permalink     Comments (2)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Page titles

22 August 2009

The page title is shown in your browser bar at the top, and also the heading that Google displays in their search results.

The title should tell what is on that page.

The title tag is also one of the most used forms of optimisation from Google.

Having multiple pages with the same page title to Google (at a quick glance) it looks like the same page.

If you don't have a unique page title, then maybe you don't actually need that page?

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Cheating Google

21 August 2009

Do not try and cheat Google as they will penalise and may even blacklist your website.

Things that Google sees as cheating:

  • Duplicate content
  • Text on the same colour background
  • Buying links to your website
  • Really small text so that users can't read it (yet Google will still read it)
  • Over repetition of keywords e.g. Cars, car manufacturers, fast cars, cheap cars, top range cars, good cars, sports cars, etc...

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Friendly URLs

20 August 2009

People often call these search engine friendly URLs - but currently Google is not actually using the URLs as a method of web page optimisation (apparently) - But it's more than likely that it will be a factor in the future.

Google can't read really long query strings - index.php?category=blog&type=entry&start_page=12&total_pages=27&viewer_id=user9&search_term=google-searches etc...

Friendly URLs are more for the user to be able to view what page they're about tobe viewing - e.g. Tell the user what's on the next page /about-search-engines/ etc...

If a Google search term is then found within the page's URL it will also bold this word just to show that Google has found this as well.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

What every website should have

18 August 2009

A sitemap that can be submitted to Google - allowing Google to index every page on your website.

A custom "404 page cannot be found" page - making this useful would also be a good way to keep users on your website, e.g. A site search, a "did you mean".

Alt text for all images.

Useful link text for every hyperlink on your website. Don't use "click here" use "Find out more about Search Engines".

An analytics application that can track users activity on the website and so show you which parts need improving to increase the visitors chances of reaching a goal (newsletter sign-up, make a sale, contact us, etc...).

The most important  text at the top left - Google, like humans, reads left-to-right, top-to-bottom and so the first thing it reads should be the most important thing.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Sending a trackback

17 August 2009

Sending a trackback will take place in the admin side of your website when you submit a blog entry.

In your admin area you will often have a field to enter trackback URLs.

When you then click submit a trackback will be sent to each of these trackback URLs.

The receiving trackback URL will then send you a success or error response to notify you of the trackback status.

Once the blog entry has been submitted I save all the blog data to the database, along with the trackback URLs that you want to send to.

I personally then have a separate page that I then go to which carries out the trackbacks after getting all the trackback URLs back out of the database where we just saved them.

Here's my code which sends the trackbacks:

<?php
if (isset($_REQUEST['id'])) //Get the id of the blog having the tracback sent to it
{

include "database/connectdatabase.php"; //Connect to the database
include "Services/Trackback.php";

$query = "SELECT blog_id,description,ping_links,title,link FROM blog WHERE live = 'on' AND id = '" . $_REQUEST['id'] . "'"; //Get the blog information to send
$result = mysql_query($query);
$row = mysql_fetch_array($result);

$site_query = "SELECT name FROM site WHERE name <> '' LIMIT 1";
$site_result = mysql_query($site_query);
$site = mysql_fetch_array($site_result);

$title = $row['title']; //The title of the blog
$excerpt = $row['description']; //The blog description

$url = “http://www.peternichol.com/blog/entry/" . $row['link'] . "/"; //The blog URL

$blog_name = $row['title']; //Not too sure on the difference between this and the $title variable, but I've put the blog title again

$trackback_url = "http://www.peternichol.com/entry/trackback/" . $_REQUEST['id'] . "/"; //The trackback URL for this particular blog entry – although I don't think this is used on outgoing trackbacks

$ping_servers = explode("n",$row['ping_links']); //From the trackback URLs it separates them (one per line)
mysql_close();

foreach ($ping_servers as $server) //Loop each of the trackback URLs
{

echo "Value: $value<br />n"; //Show the trackback URL we're sending to
$trackbackData = array( //Set the trackback data
'id' => "",
'title' => $title,
'excerpt' => $excerpt,
'url' => $url, //My blogs URL
'blog_name' => $blog_name,
'trackback_url' => $server
);

//new trackback instance
$trackback = new Services_Trackback();

//set opbject properties
foreach ($trackbackData as $k => $v)
{

$trackback -> set($k, $v);
}

//send trackback
$ret = $trackback -> send();
if (PEAR::iserror($ret))
{

echo "<strong>" . $server . "</strong> ping failed" . $ret -> getMessage() . "<br />"; //Trackback failure error
}
else
{
echo "<strong>" . $server . "</strong> ping successful<br />";
//Trackback sent successfully
}

}

}
else
{

echo "<p>An error occurred, pings not sent</p>"; //Could not send trackback

}
?>

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Setup trackback - Trackback page

16 August 2009

The trackback page should carry the blog id as a variable. If there is none then we don't want to carry on as the database query may throw back errors.

On the tracback page we want to take the blog id, search the trackback table to make sure that a trackback for this blog id and from this website doesn't already exist (as we don't want spammers attacking us).

If there are no current tracbacks from this website on this particular blog then we will add it to the database and send a message back to the originating website to say that we have added it successfully.

<?php
//Allow trackbacks
$trackbackData = array(
'id' => $_REQUEST['id'], //id of blog receiving the trackback
'title' => "",
'excerpt' => "",
'url' => "",
'blog_name' => "",
'trackback_url' => ""
);

//include class
include "Services/Trackback.php";

//new trackback instance
$trackback = new Services_Trackback();

//set opbject properties
foreach ($trackbackData as $k => $v)
{

$trackback -> set($k, $v);

}

if ($trackback -> receive()) //If this page has received a valid trackback request
{

echo $trackback -> getResponseSuccess(); //Send a success message back to the originating website

//Save trackbacks in database
global $trackbackData;
$postData = $trackbackData['nospam'];
$data = $postData;

include "database/connectdatabase.php"; //Connect to your database
$query = "SELECT id FROM trackbacks WHERE url = '" . $data['url'] . "' AND blog_id = '" . $_REQUEST['id'] . "'";  //Check if this website has sent a trackback request to this blog entry already
$result = mysql_query($query);
if (mysql_num_rows($result) == 0)
{

//save it to database
foreach ($_POST as $key => $value)
{
$$key = addslashes(trim($value));
$string = $string . " " . $key;
}
$query = "INSERT INTO trackbacks (title,excerpt,url,blog_name,trackback_url,blog_id,date) VALUES ('" . $_POST['title'] . "','" . $_POST['excerpt'] . "','" . $_POST['url'] . "','" . $_POST['blog_name'] . "','" . $_POST['trackback_url'] . "','" . $_REQUEST['id'] . "','" . date("Y-m-d H:i:s") . "')";
$result = mysql_query($query);

}

}
else
{

echo $trackback -> getResponseError(); //Send back an error response if it was not successful

}
?>


Once all the code is on the correct pages you will be able to receive trackbacks and then display them on your blog page.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Setup trackback - Blog entry page

15 August 2009

The blog page needs to show the trackback URL, for people sending a trackback to use, and also display the current trackbacks for this page.

Near the bottom of a lot of blog entries you'll often find a comments area.

Because trackbacks are another way of interacting with the page they're usually found around the same area as the commenting area.

It should show the current trackbacks – like this code that I use:

$track_query = "SELECT url,date,excerpt,blog_name,title FROM trackbacks WHERE blog_id = '" . $blog['id'] . "' AND url <> ''";
$track_result = mysql_query($track_query);
if (mysql_num_rows($track_result) > 0)
{

echo "<p>Current trackbacks to this blog entry are</p>";
while ($track = mysql_fetch_array($track_result))
{

echo "<p style="padding-left:30px;"><strong>" . display_string($track['title']) . "</strong> on <strong>" . display_string($track['blog_name']) . "</strong><br /> " . display_string($track['excerpt']) . "<br /><a href="" . $track['url'] . "" target="_blank" rel="nofollow">" . str_replace("http://","",$track['url']) . "</a></p>";

}

}


You will probably need to change some of the query string as you may not be passing in the same variables as I have already set.

$blog['id'] needs to be the id for the blog entry so that it only shows the trackbacks for that one blog entry.

Showing the trackback URL for a particular blog entry can be done by:

$site_url = “http://www.pjncomputersolutions.com/”;
$trackback_page = “trackback.php”;
$trackback_url = $site_url . $trackback_page . “?id=” . $blog['id'];


As you can see because of the $blog['id'] variable, every blog entry will have a unique trackback URL address.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

Setup trackback - Database

14 August 2009

Open phpMyAdmin or another database configuration application for your online database, and enter the following SQL query:

CREATE TABLE IF NOT EXISTS `trackbacks` (
`id` int(11) NOT NULL auto_increment,
`url` varchar(255) NOT NULL,
`title` varchar(50) NOT NULL,
`trackback_url` varchar(255) NOT NULL,
`blog_name` varchar(50) NOT NULL,
`excerpt` varchar(255) NOT NULL,
`blog_id` int(11) NOT NULL,
`date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE="MyISAM" DEFAULT CHARSET="latin1";


This SQL query code will create the table “trackbacks” along with all the fields needed for our new functionality.

If you don't have any MySQL databases you will need to setup another method for holding the trackbacks. Maybe use random access files on your web server – just be sure to set the permissions correctly so that anyone can write to the file.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us

What is needed to add trackback functionality?

13 August 2009

In order for trackbacks to work on your website you need to check the following:

  • PHP version 4.3.0 or newer
  • MySQL database (preferable)
  • FTP access to your website
  • Pear trackback script

To find out whether you have FTP access you can either look at your web server’s control panel and create a new FTP account, or you can contact your web hosts direct for FTP details. If you don't have FTP access then you will not be able to add this script to your website, try asking your webmaster to try and set one up for you.

To find out which version of PHP your web server is running create a new PHP file and add the following code:

<?php
phpinfo();
?>


Upload this file and then open the page in a web browser and view which version of PHP your web server is running.

In the web server’s control panel you should also be able to setup a MySQL database which we will use to save all the trackbacks to your website.

If you do not have any MySQL databases that you can use then we will have to use a text file to hold the trackback information. In this situation you will need to change the implementation code accordingly.

If you haven’t already got the Pear trackback script you can download it from:


Unzip the folder on your local computer.

Open the unzipped folder and find a folder called “Services”.

The “Services” folder is the only one you need to upload, so copy it to your website area and upload it to your web server.

Permalink     Comments (0)     Trackbacks (0)

Share this on Facebook  Share on Twitter   Google  Yahoo  Technorati  Reddit  Digg  del.icio.us