Article 5TMND CodeSOD: Cloudy Optimizations

CodeSOD: Cloudy Optimizations

by
Remy Porter
from The Daily WTF on (#5TMND)

Search engine optimization is both a dark art and a corrupt industry. Search providers work hard to keep their algorithms opaque. SEO is a mix of guessing and snake oil and sometimes outright lying.

For example, Mark M recently inherited a rather... bad PHP website. One of its notable SEO tweaks was that it had a tag cloud that slapped a bunch of keywords together to give a sense of what kinds of articles had been posted recently. At least, that was the idea. But when Mark dug into the code, there was no sign that there was any source of tags in the database. In fact, articles didn't get tagged at all. So where was the tag cloud coming from?

<div id="tag_cloud"> <h2>Popular tags</h2> <p> <?php $last_rand = ''; $words[0] = 'Raffle'; $words[1] = 'Skill'; $words[2] = 'Game'; $words[3] = 'Win'; $words[4] = 'Cars'; $words[5] = 'Bikes'; $words[6] = 'Holidays'; $words[7] = 'Competition'; $words[8] = 'Electronics'; $words[9] = 'Fun'; $words[10] = 'Ferrari'; $words[12] = 'Lamborgini'; $words[13] = 'Maserati'; $words[14] = 'Ducati'; $words[15] = 'Barbados'; $words[16] = 'MacBook Air'; $words[17] = 'Triumph'; $words[18] = 'Sri-Lanka'; $words[19] = 'Bentley'; $words[20] = 'Rolls Royce'; for ($i=1; $i < count($words); $i++) { $rand = random(1, 10, $last_rand); $last_rand = $rand; ?> <span class="tag_<?php eh($rand); ?>"><?php eh($words[$i]); ?></span> <?php } ?> </p></div><!-- tag_cloud -->

Yes, they just hard coded a bunch of tags that they presumed would drive clicks, then dump them into the document while applying a randomly selected CSS class to style them all differently.

It's... a choice. A series of choices, really. A series of bad choices, and I don't like any of it.

proget-icon.png [Advertisement] ProGet's got you covered with security and access controls on your NuGet feeds. Learn more. TheDailyWtf?d=yIl2AUoC8zA
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments