Monday 25 February 2008

Search Engine Optimisation (SEO)

I have been looking into Search Engine Optimisation (SEO) a little recently for my site and here are some great tips to get you going:

  1. Metadata: Get your metadata included and up to date including keywords, title, description, last updated etc. Google doesn't use keywords anymore because they have been abused by sites, but other search engines still do, but they do still use the title and description metadata.
  2. Get inbound links to your site: Get as many inbound links to your site as possible, there are a number of ways to do this including registering on free directories for your industry (search for what you are selling or providing along with terms such as "submit url", "add site" etc), do a similar search for guestbooks, forums etc in your industry and get links to your site on their as well (put your url in your signature for your forum/guestbook posts then you can get your link onto your posts without upsetting websites by blatant free advertising), the biggest win for links is on non forum/directory sites (i.e. other companies, organisations etc) but make sure people linking to your site contain relevant information or the Search Engines could take points off you for cheating.
  3. Put your titles in H1 tags: Google uses these more than keywords now, but don't put everything on your page in H1 tags, have 1 or 2 H1s and then put sub titles in H2, H3 etc or you could lose points for abusing the system.
  4. Use your images well: Don't have images on your site called things like 1lf45.jpg or even users.jpg, get your keywords into your image names, so if you are a company selling caravans in cornwall, don't call your logo logo.jpg, call it "caravans-cornwall-west-country-logo.jpg" if you have 50 images around your site you can get your keywords in there an extra 50 times! Also, remember the ALT tag on your images, again get your keywords in there and you can really improve your keyword density, sometimes by up to hundreds of times!!
  5. Place keywords wisely: Try to keep keyword heavy information in the top 25% and bottom 10% of your page. These are the areas focused on by search engines.
  6. Have a link to your sitemap on your homepage: Have a sitemap.xml page describing all the pages and their location in your site and have a link to it both at the top and bottom of your home page.
  7. Use free tools: Google provide free tools, such as their Analytics tool and also their Webmaster tool, which lets you register your sitemap with Google and see when Google last visited you and other information regarding any problems Google has with searching your site. Also, by using these tools, you are letting Google know you exist and declaring your allegiance to Google, which can't exactly lose you points with them.
  8. Submit your URL to Search Engines: Most search engines have a link to submit your site to them. Do this on as many search engines as you can, certainly all the main ones like Google, Yahoo, Alta Vista, AOL etc and repeat your submission every couple of months.
  9. Register on DMOZ: Register your site at http://www.dmoz.org/ which wins you favour at Google at the minute.
  10. Validate your pages: If you have time, it's worth validating your pages at http://www.w3c.org/ and getting their validated logos on your site. This could take time, but is a big win with Google.

All these things obviously take time, give yourself at least a couple of months to get through them all. Search Engine Optimisation is a long term process, sometimes you cannot tell for weeks or months if changes you make to your site have a positive or negative affect on your ranking in search engines.

Your hard work and patience will pay off in the long term though.

Friday 8 February 2008

Visual Studio 2008 - Switch between flow layout and absolute positioning

This was not the most obvious thing to find in Visual Studio 2008.

Back in 2003 and 2005 there was a property on the page (or something similar) that you could just set to switch between flow layout and absolute positioning.

In Visual Studio 2008 though, you need to go to Tools --> Options.

In the tree view on the left, open HTML Designer --> CSS styling and the bottom check box should be "Change positioning to absolute for controls added using toolbox"...etc.

The default will be for flow layout so it will be unselected. To absolute position controls, check this box then drag controls onto the form. Uncheck it when you want to start adding controls in flow layout again.

Tuesday 5 February 2008

Silverlight Install

If you are trying to incorporate Silverlight into your site, have a look at this article by Scott Gutherie on optimizing the Silverlight install.

It shows you how to get that nice blue dialogue form window pop up asking you to install Silverlight and covers the actual install as well.....

http://weblogs.asp.net/scottgu/archive/2007/10/30/optimizing-the-silverlight-install-experience.aspx

Saturday 2 February 2008

Comparing .NET Date on Server to Clients Date Anywhere in the World

I had to write a web application that will be hosted on US server with the date/time set to EST with daylight saving.

The application serves UK web clients, set to GMT with daylight saving, and I had to write javascript that would send the client time to the server and for the server to be able to compare it with it's own time.

I thought this would be difficult, but found this way to do it using UTC.

A little difficult to do because the base of the UTC date/time is different with .NET going for a base of 0001 AD and Javascript being from 1970. Also ticks in .net are measured in nanoseconds and javascript is measured in milliseconds.

Here is the javascript code:

var date = new Date();
var utcTicks = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());

That will get you the milliseconds in UTC (Universal Time) from 1970.

In .NET, C# here but you could do similar in VB.NET and will work for ASP.NET, WinForms etc...

DateTime now = DateTime.UtcNow;
DateTime baseTime = new DateTime(1970, 1, 1, 0, 0, 0);
long ticks = (now - baseTime).Ticks / 10000;

Note you need to subtract the base time that javascript uses so the ticks start at 1970 and also divide by 10000, because the ticks will be in nano seconds and javascript are in milleseconds.