Posts Tagged ‘SEO’

Flash and SEO

Monday, May 12th, 2008

Flash and SEO has been quite a problem and the main argument for the people in the business who is against Flash. I’ve planned to do something about this for a long time and finally I found a project that was suitable to try this. First I will say that many people think that making a website completely in Flash is craziness, and very often I do agree. However sometimes the client wants a “flashy” site with lots of animations and stuff and how am I to deny them that?

Since the introduction of SWFObject it’s been quite easy to provide the user with html content for those who does not have flash installed, and this is what I’ve done. Since I use amfphp a lot and also for my little CMS for flash, all the content except from the images are stored in a mySQL database. This makes it easy to extract all the content and echo it out in the flashcontent div tag.

I did this for a project called moelo.no and after a while Google index the whole site. To make it even more search friendly I used Apache Rewrite Engine to replace the query string URL with more search friendly URLs. I was surprised how easy easy it was to write the rewrite rule. Here is the all the lines I had to write to make it work:

RewriteRule ^kategori/([0-9]+)/underkategori/([0-9]+)/prosjekt/ ([0-9]+)(.*)\.html$ index.php?KategoriID=$1&UnderkategoriID=$2&ProsjektID=$3
RewriteRule ^kategori/([0-9]+)/underkategori/([0-9]+)(.*)\.html$ index.php?KategoriID=$1&UnderkategoriID=$2
RewriteRule ^kategori/([0-9]+)(.*)\.html$ index.php?KategoriID=$1

Now basically what this does is rewrite a url that looks like this:

http://www.moelo.no/index.php?KategoriID=1&UnderkategoriID=6

to this:

http://www.moelo.no/kategori/1/underkategori/6/

Then I add a suffix that takes the title of the article as filename and adds a .html extension to the end to to the URL to make it even more search friendly. The rewrite engine rules just ignores this. Now the URL looks like this:

http://www.moelo.no/kategori/1/underkategori/6/boliger.html

The next trick was to actually show the right content in the flash version as well when a user clicked a link in Google. I did this very easy by passing the arguments to SWFObject and this way I could load them as variables in flash:


var so = new SWFObject("http://www.moelo.no/index.swf", "index", "1000", "600", "8", "#ffffff");
so.addParam("quality", "best");
so.addVariable("kategoriid", "4");
so.addVariable("underkategoriid", "15");
so.addVariable("prosjektid", "122");
so.addVariable("forsiden", "");
so.write("wrapper");

Finally I added a rule in the robot.txt file that blocks the SWF-file from all robots.

It works like a charm!

The next job is to rewrite my hole flash based CMS into OOP because the hole shit is written in procedural code. This happened because it started as a minor project a long time ago and it has escalated for each project, and this makes it a pain in the ass to update and maintain.

Valid (X)HTML code and SEO

Tuesday, February 19th, 2008

I’ve had several discussions about creating websites with (X)HTML that validates according to W3C’s specifications. This discussion very often arise when SEO is discussed and I’ve often been thinking about the motives of the people who claims that a site with a 100% valid code is better optimized for search engines than website that do not validate. I’ve never heard any good argumentation for this. It just seems that some xhtml evangelists like to decorate themselves with a shiny “Valid XHTML”-bagde.

It has been done quite a lot of testing on valid vs. not valid code and Google and here are two of them:

1 – “Google actively ranked the websites with invalid HTML higher than the websites with valid HTML. Google even refused to rank one of the valid HTML websites altogether.”

2 – Well – the result is clear. From these 4 pages Google managed to pick the page with valid css and valid html as the preffered page to include in it’s index!”

This two tests points in two different directions. It looks like Google is pretty much unpredictable when it comes to W3C compliance.

Let’s check what Google thinks about valid code on their own website? Holy crap! 51 errors on a website with such a simple layout! Doesn’t look like Google care much about W3C validation at all!

Philipp Lenssen interviewed Matt Cutts at Googleplex:

“In more general terms, what do you think is the relationship between Google and the W3C? Do you think it would be important for Google to e.g. be concerned about valid HTML?

I like the W3C a lot; if they didn’t exist, someone would have to invent them. :) People sometimes ask whether Google should boost (or penalize) for valid (or invalid) HTML. There are plenty of clean, perfectly validating sites, but also lots of good information on sloppy, hand-coded pages that don’t validate. Google’s home page doesn’t validate and that’s mostly by design to save precious bytes. Will the world end because Google doesn’t put quotes around color attributes? No, and it makes the page load faster. :) Eric Brewer wrote a page while at Inktomi that claimed 40% of HTML pages had syntax errors. We can’t throw out 40% of the web on the principle that sites should validate; we have to take the web as it is and try to make it useful to searchers, so Google’s index parsing is pretty forgiving.”

(the whole article is here)

Please understand me correctly, I do mean and has always meant that valid code is what we should strive for, but let’s not get nazi about it. I think that this quote sums it all up pretty well:

“Creating valid templates should be a path, not a goal. The idea is to make your template as accessible as possible for humans and spiders, not to achieve a badge of valid markup. “