I was notified by a friend that he would no longer maintain his site on Abercrombie & Fitch company and 'lifestyle' news and the most important part of it (what got the most visits): the playlists. I took a chance and bought www.anfplaylists.com (originally got www.afplaylists.com). For about a month, I left it in a very crummy state with very little activity and even song lists (the main purpose of the site).
I knew the first thing I wanted after I saw it working on another site: AJAX sortable table from Views. As soon as I created my custom CCK content type, I was soon having pages like http://anfplaylists.com/abercrombie-and-fitch with Views generating the table, the columns sortable and done via AJAX.
I got motivated a little more and had some more 5 hour energy shots (=D). I had to figure out how I was going to get over 1000+ songs into this database. I surely was not about to click Create Content, then Song (my own custom type), and type the details in over and over again.
So I came up with an idea: CSV files. But I don't mean C as in comma because there are too many cases of actual comma's in song titles so I decided on the tab (\t) delimiter (what song is going to have that?). It's pretty easy to do at this point. The format is Title\tVersion\tArtist\tFeaturing\tMonth\tYear\tStore (and unfortunately Store has to be PERFECTLY case-sensitively spelled, but it's okay).
An example line:Wonderful Barry Harris Saturday Night Club Mix Radio Edit Billie Myers February 2010 Abercrombie & Fitch
My module takes a (TSV) file and imports the songs into the correct node (creating new and avoiding duplicate titles) and CCK fields. I have to keep this under 800 lines or my host server times out.
<?php
function anfplaylists_import_songs_submit($form, &$form_state) {
global $user;
// If I knew how to do Drupal uploads correctly I would :P
if ($_FILES['files']['type']['tsv'] != 'text/tab-separated-values') {
drupal_set_message(t('File was not detected as <em>text/tab-separated-values</em>.'));
}
else {
if (($handle = fopen($_FILES['files']['tmp_name']['tsv'], "r")) !== FALSE) {
$count = 0;
while (($data = fgetcsv($handle, 300, "\t")) !== FALSE) {
// #TITLE\t#VERSION\t#ARTIST\t#FEAT\t#MONTH\t#YEAR\t#STORE
// 0 = title, 1 = version, 2 = artist, 3 = feat, 4 = month, 5 = year, 6 = store
// could be '': version, feat
$title = $data[0];
$version = $data[1];
$artist = $data[2];
$feat = $data[3];
$month = $data[4];
$year = $data[5];
switch($data[6]) {
case 'Abercrombie & Fitch':
$store = 0;
break;
case 'abercrombie kids':
$store = 1;
break;
case 'Gilly Hicks':
$store = 2;
break;
case 'Hollister Co.':
$store = 3;
break;
case 'RUEHL No.925':
$store = 4;
break;
default:
$store = 0;
break;
}
$played = date('Y-m', strtotime($month.' '.$year));
$played .= '-00T00:00:00';
// Check if a node by the same exact #TITLE doesn't already exist
if (($node = node_load(array('title' => $title))) !== FALSE) {
// Check if version is the same as input
drupal_set_message('Node '.l($node->title, 'node/'.$node->nid).' already exists. Check that it is not a duplicate.');
continue;
}
else {
$node = new stdClass;
$node->type = 'song';
$node->status = 1;
$node->comment = 2;
$node->promote = 0;
$node->moderate = 0;
$node->sticky = 0;
$node->tnid = 0;
$node->revision_timestamp = time();
$node->uid = $user->uid;
$node->name = $user->name;
$node->title = $title;
$node->field_song_artist = array(array('value' => $artist));
$node->field_song_feat = array(array('value' => $feat));
$node->field_song_version = array(array('value' => $version));
$node->field_song_store = array(array('value' => $store));
$node->field_song_store_played = array(array(
'value' => $played,
'timezone' => 'America/New_York',
'timezone_db' => 'America/New_York',
'date_type' => 'date',
));
node_save($node);
$count++;
}
}
fclose($handle);
drupal_set_message(t('Added '.$count.' new songs.'));
}
else {
drupal_set_message(t('Error occurred opening file. No data processed.'));
}
}
}
?>There ARE cases where the song title will be the same (not a case-sensitive check). For these, I manually do them with the node creation form. These are songs that have different artist or a different version. It is not a big deal. Usually no more than one.
As soon as I got 1000+ songs in the database, the key to ranking seemed to be an implicit choice on having each song have its own page, as well as good titles, keywords, meta tags, etc. I noticed also that Google loved me at first but then realised how many parameterised URLs I have (from Views mostly). I was penalised heavily for this and the solution was in Nodewords: turn on Canonical URLs! This makes Google not count the pages as duplicates. A little than 2 weeks later, all the duplicates that were caused by Views and other pages were gone.
I'm not too sure on Google's policy on nofollow at this point for anchors. I feel like they count but extremely low if any links to your site use them. I know in Google Webmaster Tools, it shows the links from Facebook (which all have nofollow) but I think they are counted very low regardless of the fact that Facebook is huge.
Modules in use:
- AddThis (although I honestly don't like this very much)
- AdSense
- CCK modules
- Conditional Styles
- Dtools (critical for any production site if you ask me)
- Javascript Aggregator
- Almost all modules recommended by SEO Checklist
- - Mollom is amazing and no one should look to anything else. I was getting spammed with pharmaceutical stuff a bit and now it never happens.
- Pathauto - You can imagine how critical this is for SEO
- Poormanscron (because Cloud Hosting is not that great)
- Many others...
The theme is my custom-made theme. It's very small. I decided on the colours, but I wanted no images for now. I am not a themer (more coding), but I managed to get that together without even using template.php. There are some Views templates in there for showing the affiliate links properly (both of which are CCK fields).
Recently I deployed Fivestar (with Votingapi) to allow users to vote. The great thing is they can vote within the view, but unfortunately this messes with sorting. Views is not getting the latest row(s) to tabualte with regarding votes on nodes.
Love Drupal. I cannot imagine using Wordpress or Joomla for all this (it would take far too much time).
Any questions? Just ask :-)