Integrating a link blog into a Wordpress blog | 25/09/09 - 16.38 |
I never fully got into using delicious for my links. I always preferred keeping my links on my own turf, so I’ve used browser bookmarks and more recently I created DavysoNub as my personal URL shortener and bookmarker. I never quite built up the UI enough there though. I think really I wanted something a bit more like Tumblr but fully self hosted.
Then when browsing Daring Fireball I realised that what I really wanted was what he running. He has blog posts interspersed with links with added commentary. The only different between the posts that are links and the “true” blog posts is that clicking on the title of one of the link posts takes you directly to the source rather than to the permalink page for the post. A star is provided to the right of the post title to further differentiate the entries and also to provide an actual permalink for the link and comment.
John Gruber uses Movable Type so I’m not sure how he achieves the effect he has. I however use Wordpress so I knew I’d have to use a different work around anyway. After a bit of fiddling around I now have a similar system going on this blog. This is how I did it:
- In the template of the blog where the title is posted I edited it to be conditional on a new custom variable. This variable will hold the address that the link posts will link to. To retrieve the custom variables you use this php snippet within the loop:
$custom_fields = get_post_custom();
$link = $custom_fields['Link_Post_URL'];
$url = $link[0];
- Now use the contents of the $url variable to determine which sort of title to display. Something like this.
<? if($url=”") { ?>
…// normal title with link to permalink for blog posts
<? } else { ?>
…
// link title for link posts
<A HREF=”<? echo $url; ?>”><?php the_title(); ?></A>
<? } ?>
- Finally when you make a post – add a custom variable to it with the name Link_Post_URL to those that you want to make link posts. After you’ve added it the first time there’ll be a drop down menu to make it easy to add it again.
Remember to try and differentiate posts in some way to explain to the readers how your posts differ. On this blog I’m using grey backgrounds for blog posts that are true blog posts and non-grey backgrounds where it’s just a link. I’m also omitting the comment link and second timestamp on the link posts.
Now all I need to do is to get this linked up with DavysoNub. I’ll see what I can do with that.