Gold Plated Blog Posts
Whatev.
Tuesday, November 6, 2007

Getting the Most From Your Blog

I started out back in May with a blog that accessible on Blog*Spot at cameronhinkle.blogspot.com. Well, that wasn't quite cool enough. I didn't like the URL and I definitely didn't like that ugly blue bar at the top of every Blogger blog. Additionally, I wanted a central place for all my stuff. I wanted cameronhinkle.com to not just be a blog, but to be a place where I do whatever I wanted. This is when I started looking into Blogger's API.

Hopefully you can tell by reading this blog that using Blogger's API has worked pretty well. In fact, because I'm not hosting the blog on Blogger's servers, I have a lot more flexibility with what else can go here, which is why you can also browse my Picasa collection as well as static HTML content. I basically enter my blog posts using the standard Blogger interface, and then when you browse cameronhinkle.com it polls Blogger's servers to get the latest content. While this has worked out really well, there have been some obstacles. If you're thinking about doing this yourself or you're already doing this same thing, maybe this will clear up some of the obstacles.

Duplicate content at your old address

I was not happy about having my blog displayed both at cameronhinkle.blogspot.com and cameronhinkle.com. This is bad for SEO and makes cameronhinkle.com look redundant. I initially solved this by deleting the "Blog" widget from my template and replaced it with static text linking to this site. This worked okay, but it still left cameronhinkle.blogspot.com as an active site and Blog*Spot's RSS feeds still came up in search results. Since the RSS feeds don't link back to cameronhinkle.com, I found this to be a problem.

Blogger has a cool feature that allows you to host your blog on their servers from a unique address. You tell Blogger in your Settings->Publishing tab that you want to host your blog from a custom URL, then you configure your site's DNS entry through your registrar to direct requests for the custome URL to Blogger's servers. Well, I didn't want to host the site on Blogger's servers, so I didn't think this custom URL would work for me. As it turns out, I could configure Blogger to think my blog is at cameronhinkle.com and then just not change my DNS entries. Blogger will then forward all requests for cameronhinkle.blogspot.com to cameronhinkle.com. I did some research using wget and found that it's doing a 301 redirect, which transfers all the PageRank from cameronhinkle.blogspot.com to the cameronhinkle.com. However, there was one small problem...

Paths restricted in custom URLs

My blog is hosted at cameronhinkle.com/blog, which is a path rather than a domain or subdomain. I attempted to put cameronhinkle.com/blog into the Custom URL field of Blogger's Publishing tab, but it wouldn't accept it because it only accepts domains or subdomains. Initially I just lived with the old URL redirecting to cameronhinkle.com, but then I had a better idea. I set up a subdomain called blog.cameronhinkle.com that does a 301 redirect to cameronhinkle.com/blog/. Now any requests to cameronhinkle.blogspot.com will get redirected to blog.cameronhinkle.com, which will in turn link to cameronhinkle.com/blog/. Try this out in Linux if you can by typing the command "wget cameronhinkle.blogspot.com".

Pinging services

You've probably all seen the option to "Send Pings" in Blogger's Settings->Basic tab. This is an important feature, as it alerts several blog services that you have new content. It can be extremely useful in driving visitors to your blog. Unfortunately, since I enter posts into Blogger.com (I have no interest in using Blogger's API to enter new posts since it's not visible to anyone except me and Blogger's interface is just fine), I there was no event on CameronHinkle.com that could be triggered and send off a ping. Additionally, maintaining the list of services to ping and how to ping them is something much better left to experts at Blogger, if at all possible. Unfortunately, before I had set up the configuration described above, Blogger would ping services with an update for cameronhinkle.blogspot.com, but it didn't know about cameronhinkle.com. Since implementing both of the above steps, Blogger knows my actual address, so it will correctly send out pings. Just doing the first step left Blogger sending out pings for cameronhinkle.com (which was okay), but doing step two correctly got Blogger to send pings for blog.cameronhinkle.com. Because of the redirect I set up, this works perfectly.

Blog*Spot RSS Feeds

I often found my blog contents in BlogSpot's RSS feeds, which I did not want. Their feeds would only direct users to cameronhinkle.blogspot.com, which would just be a link to cameronhinkle.com and that wasn't good enough. Even after doing the steps mentioned above, the RSS feeds would have the wrong URL structure; it would link to cameronhinkle.com using Blogger's URL structure because it had no idea I had created my own URL structure. I had already created my own RSS feed using PHP, which is the one I would really like users to find. To remedy this, I used Bloggers "Post Feed Redirect URL" option. It's supposed to be for FeedBurner or other similar services, but it works for this as well. Now Blogger thinks my RSS feed is at http://www.cameronhinkle.com/blog/rss/, which is where it should be.

Comments

There is not, as far as I can tell, a great way to actually incorporate posting comments through the API. Retrieving comments is easy enough, but posting comments requires that all users first log in to Blogger. I don't anticipate a lot of comments so I would really rather that users can post anonymously and I can moderate any spam posts, etc. I did some digging to try to figure out how Blog*Spot does posting to see if I can reverse-engineer it. I found that all blogs on Blog*Spot actually do their posting through Blogger. I think this is for security. To check it out, post a comment on any Blog*Spot blog and you'll see that the page where you enter your comment is hosted at Blogger.com. So given this fact, I didn't mind if comments on my site were entered through Blogger. To make it as seamless an experience as possible, I got the URL for posting comments through Blogger, which is https://www.blogger.com/comment.g?blogID=YOUR_BLOG_ID&postID=YOUR_POST_ID&isPopup=true, and made a link display after every blog post that opens a popup to that page. Specifically, the link says this:

<a href="https://www.blogger.com/comment.g?blogID=YOUR_BLOG_ID&postID=YOUR_POST_ID&isPopup=true" onclick='javascript:window.open(this.href, "bloggerPopup", "toolbar=0,location=0,statusbar=1,menubar=0,scrollbars=yes,width=400,height=550"); return false;'>Add a comment</a>


I took this link straight from another Blog*Spot blog and this ensure that it opens to the correct width and with the correct javascript values set. Now users can comment on any blog post and each comment is displayed through the API (which is, as I said, easy enough to do), but new comments are added through a popup hosted on Blogger.com. So the popup doesn't look like CameronHinkle.com, but this way users can easily login if they want or post an anonymous comment.

Future upgrades

The one thing that I think I'm still missing here is that sometimes I'll find cameronhinkle.com/blog in search results with Blog*Spot's URL structure appended to it. This is a result of Blog*Spot thinking that I'm hosting it on their servers at a different address. So the future enhancement will be to make my site's PHP engine correctly interpret paths from Blogger. The more I look at this problem, the more complicated it could potentially be. I think I will probably settle for a "close enough" solution. That may still be several weeks off.

Learning how to do all of this has been a really rewarding experience because I'm proud of the final outcome. I feel like I have a site that is really easy to customize and an interface for entering blog posts that is I never have to think about. Hopefully these tips will stop someone else from having to do all this research themselves. If anyone has any other good tips, please feel free to let me know!

The articles in this blog are authored by Cameron Hinkle, Software Engineer for Nike. The thoughts and opinions expressed are not shared by Nike or any of its affiliates.