Archive for the ‘WordPress’ Category

Working With Code

Now that I have some content, and a nice habit of writing every day, I’ve started concentrating a little more on how this blog looks, especially since the May 1st reboot is only 8 days away!

To start, since this is a blog mainly about writing some form of code or another I needed a good way to do some syntax highlighting. My requirements were pretty simple, it should require very little manual intervention beyond the <code><pre></pre></code> tags, it should support HTML, CSS, JavaScript, Java, and possibly Ruby and PHP, and line numbers would be nice. I found all of this in the wonderful wp-syntax plug-in by Ryan McGeary based on the GeSHi Generic Syntax Highlighter.

Setting it up was a breeze, as usual for WordPress plug-ins, upload, unzip, and it works. Creating the markup was also pretty simple, since all of my code blocks were already wrapped in <code><pre></pre></code> it was just a matter of adding the appropriate lang attribute to the pre element. I did however, run into one minor problem, I had all of my HTML code escaped to to use &lt; and &gt; instead of < and >, but one quick search and replace in MarsEdit for each post, and that was solved as well.

Clearing My <head>

It always struck me as odd, but I originally had three types of feeds on this site, Atom, RSS 0.93, and RSS 2, this is accomplished quite simply with the following code block in WordPress:

10
11
12
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" >
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" >

That code was only really there because the theme I used as my base had it, so I kept it without thinking. I run my feed through Feedburner, which has a feature that is supposed to provide the format that your reader can read, assumably making multiple feed definitions unnecessary. I’m not sure how that works, or if it works with the Feedburner plug-in for WordPress, but it’s turned on in my Feedburner account.

While hacking feeds out of my head I chose to keep the RSS 2.0 feed because WordPress seems to favor it based on URL structure; with RSS 2.0 being /feed and RSS .92 and ATOM being /feed/rss and /feed/atom respectively. With that answered, I suppose the next question is “why?” Well, mainly because of this article by Dean Allen over at Textism. It just makes sense, and from a usability standpoint, the easier to subscribe to my feed the better! Less choices equals easier to use, so maybe this will help my subscription numbers if people can subscribe without thinking.

With that being said, I initially 301 redirected the other two feed URLs to the RSS 2 URL using the technique described in this post, which I’m assume should work perfectly, but I’m guessing that is unnecessary, since the URLs themselves will continue to function thanks to WordPress’ default behavior, so I took the redirects out. If anybody has any problems accessing the feed, or thinks my methodology should change, please enlighten me with a comment to this post.

Following The Conversation Elsewhere

A few days ago I commented on this post over at Publishing 2.0, ignoring the semantic debate of whether the article described intermediation or disintermediation, I came up with an idea that I personally find very interesting. I touched on this idea on Tuesday’s post when I said:

How about blog and forum comments, it would be great to have an authenticated and decentralized means of establishing me on a site that is not my own. It would be even better if I could then aggregate these comments into my own site to track my current conversations in the blogosphere.

In that article I relied on Google to crawl the site and provide the aggregation for me, what if we looked at it more like my Publishing 2.0 comment and provided a reverse trackback ping.

In order for this to really work, we need a few things, one, we need a service that accepts the ping; Wordpress accepts trackback pings, so let’s assume this is easy to implement. Since most blog comment systems accept a blog URL, we know the author’s URL, append to that a well known URI to accept the ping and we now have an endpoint. So far, so good. Next, we need identity, in order for this to work people cannot be able to spam the system, we need a pretty solid concept of identity. To borrow from MicroID, URL + email = identity, since most (if not all) blog comments accept email and don’t show it, we can create a MicroID hash and add it to the comment’s container element as a class according to the Microformat class pattern. Finally, once the comment is approved and posted, the blog pings the commenter’s blog with the generated MicroID and the post URL, the commenter’s blog visits the site and extracts the comment via the MicroID class, and adds it to the feed of current conversations.

I like the concept, only one problem, it requires both the client and server to understand this reverse trackback ping. If we lived in a Wordpress-only world this would be pretty simple, one plug-in, or better yet a change to the code base, and the functionality is there. I’ve also considered a JavaScript bug placed in the post by the author who’s blog contains an endpoint, but javascript and comments probably don’t mix well, and we really only need a ping the first time not every time the page is loaded. Another option would be the manual approach, telling your own blog to go crawl the blog you’ve just posted on for your comments; or possibly even a third-party service that just crawls blogs looking for MicroID classes and then publishes the results as a feed that a commentor’s blog can consume. Manual is pretty much overkill, it would probably be easier to just create a new post and copy and paste the comments. The third party service just means one more service silo and eliminates the control of your own identity because now the content is stored there, as well as the problem of having to rely on a third party to spider the blog before your content gets updated. So there’s the impasse, a logical idea without a practical application.

For now, my first Wordpress plug-in is going to be an experiment to see if this works, and then we’ll move on from there, unless of course Chi.mp is moving in that direction, then I guess we’ll just have to see what they come up with.

On Feeling Lonely

My blogroll needs some love. I’m looking for some quality blogs out there who are just starting up. They should be on a similar topic, somewhere close to SEO, CSS, JavaScript, Web Standards, and/or Java Programming, but that’s really open for negotiation.

Here’s my problem, my co-workers don’t blog, I doubt most of them have even heard of Wordpress, and nobody really has enough of a passion to take the time to write. So, if you’ve got a young blog, or you know of a blog on a similar topic, please send me a link in a comment. I’m looking for blogs that update often, or at least regularly, because I need some fresh, on-topic content to comment on and discuss. Who’s out there? This is not a link exchange request, I don’t expect reciprocation, but I wouldn’t complain if you did, and please don’t spam me with links to non-related sites.

In other news, I’ve come across a few interesting Wordpress plugins that I’m going to be trying out, wp-typogrify, and Registered Users Only (not for this blog). So, look for those changes and if I find anything interesting about them I’ll let you know!

Fixing the SERPs When Changing Permalink Structure in WordPress

As of today, if you run a Google search to see what pages of my site are in the index you’ll find quite a bit. However, the pages in the index reflect a URL structure that I’m not thrilled with for SEO reasons. In order to remedy this problem I did some playing with Google’s webmaster tools and my .htaccess file. As of today we’re going to employ some 301 redirects to get the SERP’s pointing in the right place, remove some old pages from the index, and modify my robots.txt. Hopefully these changes will concentrate my search results to show off the real content of this site and lose some of the fluff. Along the way, we’re also going to find out how long it takes for these corrections to take place.

First things first, here’s the problem, if I do a google site search like this site:www.ericdelabar.com I get results that look like this:

serp.gif

Notice the entries that look something like www.ericedelabar.com/?cat=11? They all work, but they’re not ideal for SEO, so first things first, the .htaccess file.

1
2
3
4
5
6
7
8
9
10
11
12
13
redirect 301 /?cat=1 http://www.ericdelabar.com/
redirect 301 /?cat=5 http://www.ericdelabar.com/category/standards
redirect 301 /?cat=6 http://www.ericdelabar.com/category/seo
redirect 301 /?cat=7 http://www.ericdelabar.com/category/firefox-extensions
redirect 301 /?cat=9 http://www.ericdelabar.com/category/eclipse
redirect 301 /?cat=10 http://www.ericdelabar.com/category/the-hard-way
redirect 301 /?cat=11 http://www.ericdelabar.com/category/css
redirect 301 /?cat=12 http://www.ericdelabar.com/category/view-from-the-trenches
redirect 301 /?cat=13 http://www.ericdelabar.com/category/user-behavior
redirect 301 /?cat=14 http://www.ericdelabar.com/category/usability
redirect 301 /?p=5 http://www.ericdelabar.com/2007/02/in-beginning-there-was-doctype.html
redirect 301 /?p=7 http://www.ericdelabar.com/2007/03/lets-talk-about-tools-part-2.html
redirect 301 /?p=8 http://www.ericdelabar.com/2007/03/css-things-i-learned-hard-way-absolute.html

Each line in the file is a rule, the redirect is the command, the number is the type, which in this case is 301, which means “moved permanently,” the original URL comes next, and then finally the desired URL. Looking at my list, I have two basic redirects here, redirects to convert from category id to the category name, and redirects to convert from post id to post slug. These lines must be before the # BEGIN WordPress comment in your .htaccss file, if they are not, they will not work.

Now that categories and posts are redirecting, there is one final problem, the last few pages of results contain quite a few search result pages. These pages have a URL pattern something like the following: http://www.ericdelabar.com/index.php?s=firebug. I don’t really want my search result pages in the SERPs, but I’m not ready to get rid of them all yet. To remedy this I simply installed the Search Permalink plug-in which redirects the ?s=keyword pattern to /search/keyword/, which is not perfect, but looks a little nicer than the query string. In the long run I will probably remove them from the SERPs altogether, but I haven’t decided on my search strategy for this site yet, so I’ll leave that for another day.

Next we want to keep Google out of the site admin, so we add the WordPress login page and admin section to the robots.txt file by adding the following lines.

4
5
Disallow: /wp-login.php
Disallow: /wp-admin

Next, we’re going to use the Google Webmaster Tools to remove the wp-login and wp-admin pages from the index. This requires that the pages have either a robots.txt file disallowing them or a robots metatag with noindex specified. Since our robots.txt file should handle this, our request should look like the following:

remove_page.gif

Finally, we resubmit the site for crawling and hope that this gets cleared up within a few days.

Now this methodology only specifically addresses Google, my site has also been indexed in MSN, Yahoo, and Ask, and steps will have to be taken to resolve these as well, but fixing Google is definitely a good start!

Now running WordPress 2.5 from SVN

Since I found out that HappyCog redid the admin for WordPress 2.5 I’ve been interested to see what it looks like. This morning I decided it was time. I originally used the DreamHost one-click install to setup my initial install, and although it is a nice feature, I decided that SVN was more my thing. Going through the steps provided was pretty simple, and my upgrade was complete in about five minutes total.

As far as compatibility, all of my existing plugins “worked” but the XML Sitemap plug-in looks a little funny thanks to the new admin design. While I was at it I added the ClickPass plugin as a follow-up to my recent foray into OpenID. I’m not sure it’s working correctly, I can login with my ClickPass account (which I’m assuming is cookie based), but have been unsuccessful merging my preferred OpenID, or even the one Technorati provides. I will have to look into that one a little further, but until then, no ClickPass for me.