Waxy.org
Waxy.org is the sandbox of Andy Baio, an independent journalist and programmer living in Portland, Oregon. I created Upcoming.org and some other stuff too.

Contact Me: log@waxy.org or waxpancake on AIM

Backlinks

Posted May 10, 2002

Occasionally, there's an idea so simple and powerful that you have to drop whatever you're doing and implement it immediately.

Yesterday, I read the Jon Udell article that's making the rounds (via Mefi and Flutterby). I didn't immediately grok it, but seeing it in action (1, 2, 3) did the trick.

Visually, I was inspired by Mark Pilgrim's concise display, but didn't want to periodically parse through my Apache logs. I wanted real-time results without limiting myself to one particular web server log format. So I wrote a Perl script that's now included on every entry page via SSI, using flat files to store the data.

As a result, there may be some issues with scalability on heavily trafficked sites, but I'd think most weblogs wouldn't have a problem. Anyway, if you want to try it, all it requires is Perl, server-side includes, and a world-writable directory to store the files in. Download Waxy Backlinks now. Installation info inside.

Installation is pretty easy, so long as you know your way around a Unix shell.

1. Rename the file from backlink.txt to backlink.cgi.
2. Save the file to a directory readable by your web server and make it executable (e.g. 'chmod 755 backlink.cgi')
3. Create a directory to store the cache files in and make it world-writable (e.g. 'chmod 777 backlink_dir/')
4. Edit line 16 of backlink.cgi, changing the '$backlinkdir' directory to point to your own cache directory.
5. Add the following server-side include to your .shtml file(s), where you want the backlinks to be displayed:
<!--#exec cgi="/cgi/backlink.cgi" -->

That's it! If you'd like, you can optionally customize the display by changing the header, footer, and backlink HTML in the script. If you get stuck, I might be able to help.

8 Comments (Add Yours)

May 13, 2002
4:53 PM  
Andy Baio wrote:

Hmm, I think I need to add a couple features to the script. The ability to set a maximum number of links to display, a minimum threshold of visitors to display, and the option to group recent links by top-level domain. As you can see, it doesn't take long before the list of links gets unruly.


May 29, 2002
10:19 PM  
paul wrote:

This is super cool: I may clone it to track user agents the same way (keep an eye on robots vs real readers). I seem to be showing up in my own backlinks, even though I added myself to the "blacklist."


May 29, 2002
10:40 PM  
Andy Baio wrote:

Are you correctly adding your hostname to the @blacklist array? Try changing it to read something like:

my @blacklist = qw($ENV{HTTP_HOST} subdomain.example.com);


Aug 29, 2002
5:36 PM  
Dawn wrote:

Hi. Found this in a Mefi post which I found through google. Is this Perl script possible to implement on a PHP site. My pages are *.php, so I don't think I can run SSI on a php page. Thanks!


Aug 29, 2002
6:04 PM  
Andy Baio wrote:

I'd recommend using Phil Ringnalda's PHP port of my Backlink script, or this newer version of my script.


Jun 28, 2003
5:19 AM  
feri wrote:

Would you please help me to find out why the back link does not work?
http://www.alphatheme.com/b/archives/000008.shtml
I did try with and SSI works.
The path is also seems correct.
my $backlinkdir = '/home/virtual/site1/fst/var/www/cgi-bin/mt/backlink';

The code was:
I got an error so I did change it to:

I don't know what else should I check?
THX


Jul 16, 2003
2:04 PM  
Michael wrote:

I don't have any idea ... it just don't works.

on my indexpage it looks like:

[...]
echo $display;
?>


backlink.cgi looks like:

my $backlinkdir = '/usr/local/httpd/htdocs/kunden/web121/html/public/backlink';

php = 0

www.feiern-events.com


Jun 20, 2004
8:58 PM  
Steve wrote:

Interesting, I'm gonna try this script...


 
Waxy Links
Ads via The Deck
November 18, 2008
Bike Hero, biking a Guitar Hero level in the real world — most likely a commercial viral, and maybe even fake, but does it matter? beyond awesome
Chuck Klosterman reviews Chinese Democracy — mostly posting this just to beat Rex to it
The A.V. Club's 27 popular websites that became books — though they missed Belle de Jour, The Washingtonienne, Fucked Company, Fark, and ZUG
Speed Guitar goes to the Los Angeles County Museum of Art — every hour, on the hour, for one solid minute of metal complete with gothic arch and smoke machine
MGMT's "Kids" on the iPhone Ocarina — "the iPhone Ocarina officially replaces the recorder as the nerdiest instrument I can play"
Mena Trott responds to Valleywag article about their Disneyland vacation — my favorite was Space Mountain Snob
LIFE Magazine photo archive hosted by Google — millions of high-res photos, most never published
Amazon launches CloudFront, their pay-as-you-go CDN — very complementary with S3
November 17, 2008
John Hodgman, Jonathan Coulton, and the Long Winters perform "Tonight You Belong to Me" — "Thank you, normal-sized man."
Jerry Yang stepping down from Yahoo's CEO post — it never really fit him well, though I'll miss his e.e. cummings memos
Woman asks Apple community about an unusual iPhone glitch — no, raunchy photos don't accidentally attach themselves to outbound email
Greasemonkey script to pull WikiDashboard visualization into Wikipedia — I made a LazyWeb plea for this last week, and Paul Irish came through
Lee Byron's Fireflies, anaglyph 3D game for Mac — part of Kokoromi's Gamma 3D showcase of anaglyph games
Flickr Boundaries, tool to explore Flickr's shapefiles — read Tom Taylor's entry for more information
Cooking Mama, the Unauthorized PETA Edition — a strangely obscure target for their attention, with a petition to write to the game's publisher (via)
Boing Boing launches gaming blog, Offworld — good writing in a nice design from Brandon Boyer, former news editor of Gamasutra
"Violet" wins the Interactive Fiction Comp 2008 — play it online; glancing at the charts, it looks like Buried in Shoes was the most divisive
Trailer for J.J. Abrams' Star Trek prequel — looks surprisingly good, but I'm a sucker for origin stories; I even liked Enterprise
What would Depression 2009 look like? — Tim sums up the thought-provoking Boston Globe article
The Pirate Bay hits 25 million simultaneous peers — that's not unique people, but concurrent connections; Napster peaked at 26M users
Peter Hirschberg releases Adventure as a free iPhone app — related: Chasing Ghosts will finally be released on BitTorrent Showtime in December (via)
The Big Picture on the California wildfires — also: first-person coverage on Twitter and YouTube, like this freeway on fire and aftermath
Tim-Tams available at Target until March, first time available in the U.S. — best chocolate cookies ever, the Tim Tam Slam is a chocolaty revelation (via)
JS-909, a Javascript drum machine without Flash — through a hack, it even works in IE 6
November 14, 2008
Esquire's hosting Between, the new two-player networked game by Jason Rohrer — from the creator of Passage
"What's that buzzing noise from my BBQ?" — he thought he was killing a few bees, but ends up annihilating an entire colony (via)
November 13, 2008
Kottke explains how to embed high-quality YouTube videos — I knew how to save, link, and change the default, but the embedding hack was new to me
Web 2.0 Origami — lazyweb, please build a converter that creates folding patterns from an uploaded image
Pixar's Burn-E short on YouTube — here's an interview with the director
Valleywag folded into Gawker, all but Owen Thomas laid off — I won't miss it; they hurt a lot of good people and interesting projects in the quest for pageviews (via)

Andy Baio lives here. Some rights reserved, for your pleasure.