Saturday, May 22, 2010

Fixing your feed part 2

English-language syntax is tricky, and the Short pipe does a number of little tricky things to compensate. Even so, the generic replacement rules sometimes run into an exception that screws things up.

For instance, my pipe was evaluating the text string "U.S." as a place that needed a line break after the first period.

Why? The Short Feed pipe evaluates any period followed by letter with no intervening space as the end of a paragraph, in need of some line returns. (The Full pipe does not do this.)

I could have edited the post where I originally wrote "U.S." to be simply "US," but that would have been incorrect usage and I am fussy about that sort of thing. So I wrote an exception into the pipe.

I will show you what I did so that you can write simple exceptions too. (For example, you might write about time and say "11:30 A.M.") As a first step, you must go to your pipe and click Edit.

Fixing your feed part 1

For Short feeds only.

I built the Short pipe for this hack to work on blog feeds that have been limited to the first 255 characters or so. It assumes no more than nine paragraphs or so.

That should be plenty if you set your feed options to "short."

However, even a Short feed could theoretically have more than nine paragraphs in a post. If you have a post with lots of really short paragraphs at the beginning--perhaps a list of eight or more short items with line breaks in between--then you may see see some paragraphs run together with no line breaks between them.

I do think this is unlikely, but it is possible.

If your feed is missing some line returns even after it has gone through the Short pipe--and if you've already followed my advice about trailing spaces--and if your pipe catches the first nine returns or so but then fails--then this post is for you.

You can skip to the next post if that doesn't apply to you. Otherwise, go back to Yahoo Pipes, log into your Yahoo account if needed, click "My Pipes," then on the pipe, then on "Edit Source" and scroll down the page.

Friday, May 21, 2010

Still missing some line returns?

If you are still getting run-together paragraphs and have the Short feed, there are two possible causes. (If yours is Full, or if you are just building a list of blog-post titles, you are done! Go here.)

One possible cause is that you have line breaks without punctuation, such as you might find in a list of items:
  • cheese
  • socks
  • chalk
  • birthdays
If so, you might see a line in your feed that looks something like this:
cheesesockschalkbirthdaysIf so, you might see...
--all of the returns you put in your post brutally stripped away by the Short feed.

Your possible remedies for that are as follows:
  • You can edit your post and punctuate your list, with periods or commas or semicolons;
  • You can edit your post to put a space after all the list items except the last one, which you punctuate (so that you get "cheese socks chalk birthdays." all on one line);
  • You can edit your pipe to deal with this list, as described here.
A second possible cause, less likely, is that my pipe does not perform enough search-and-replace operations on your feed to catch all of the returns in it.

This would only happen if the start of one of your blog posts included more than seven paragraphs. Coincidentally, that could be because of a list of items like the one above, but (a) it would only kick in after the seventh return (or so) in your blog post and (b) would occur even if you punctuate your list.

The remedy for the second cause is to edit the pipe to add more search-and-replace operations. I explain that here.

Missing line returns and trailing spaces

You can skip this step if you are using a Full or Jump-Break feed or if all you are publishing is a list of post titles.


Your thirst to present your blog content in chronological order has led you to publish a feed of your blog and run it through a pipe, then make a second feed from that and convert it to a script that you publish on your blog.

Probably you've even taken the next step of using CSS to format the way your blog presents the feed. (If not you can do that next--or go back and do it right now.)


But, are you happy?

If you take the time to proofread the final result, I hope you will be pleased. At last, you can relive the journey that your blog has been for you--and share it with your readers.

However, if your feed is set to Short, you might also find some anomalies and typos that you can only fix by editing your pipe or your blog.

Thursday, May 20, 2010

Format feed with CSS

To format, or not to format?

If you are using my blog-journey hack to put your blog in chronological order, one of the things I explain how to do is to format the results.

You could, for instance, try to make your reordered version look as much like a series of regular blog posts as possible, by copying the formatting for blog-post titles and text.

However, formatting is optional. And, if all you really want is a list of the titles of your blog posts in order, formatting is really not necessary at all.

Stylin' your blog-post-order hack (part 2)

As I try to explain in part 1, the code that structures your blog ("This is a blog post" "This is a heading" etc.) has to be associated with style definitions that are elsewhere. In this case, "elsewhere" is in the template for your blog.

We'll be adding new style definitions to your template but not changing any existing ones. First, however, we have to tag your hack so as to associate it with the new formatting.

Return to the static blog page where you pasted your script and open it in the html editor.

The actual script is included inside a <script.../script> tag. To tag that for formatting, put it between the following tags:
<span class="rss-journey"> [<script.../script>] </span>
where [<script.../script>] refers to the first part of what you've already pasted.

Publish this. There will be no change yet, but the span class now allows you to format the feed your script is rendering on that page.

The code that will format your css looks something like this:

Stylin' your blog-post-order hack (part 1)

You've jumped through all the hoops to get your blog content listed in order, oldest first, on your blog: feed, pipes, javascript, and back on a static page on your blog.


The next part of the hack uses cascading style sheets to format how your feed looks.

Are you satisfied with your formatting? If so, skip this step and go here. (If you're not sure, maybe this will help you think about whether to tweak the formatting.)

Otherwise, prepare yourself for a peek under your blog's hood.

The script puts the feed in your blog

This is the script
that displays the feed
that comes out of the pipe
that mashes the feed
that you publish of your blog
to install the blog-journey hack.

Specifically, the code you got from feed2js (or similar service) will show your feed on a web page, on any browser that supports javascript.

I recommend that you put your feed on a static blog page, not in a blog post where it could cause some problems. The feed is potentially big and will slow down your blog (and eat up your page-size quota) if you put it in a post.

From feed to script

Blogger is stubborn about blog-post order. Last things first, on the theory that blog readers are not interested in what you said yesterday.

Fortunately, Blogger has been flexible about allowing bloggers to post their own scripts in the javascript language in their blogs.

What this means is that you can show your blog content as a journey, in first-first chronological order, if you are willing to jump through a few hoops: publish as a feed, squirt the feed through Pipes, and convert the feed of that to a script. is one of several web-based services that convert feeds to scripts that you can just paste onto a blog or other web page. The script will then display the feed. (Formatting is another matter.)

You will be using feed2js's "build" page. Take the feed url from the result of your pipe (with an "http:" at the beginning) and paste it into the "feed url" box on that page.

Then review the options for the feed.

Segmenting your blog-journey by date

Especially if you have many posts in your feed, you might want to break your blog journey into chunks by date.

You could, for instance, have each year of posts on a separate page, or break up the flow by month or year. "May" followed by "June," etc.

You may also discover--as I did, when I switched from the Short feed to the longer Jump-Break feed--that your blog-journey is cut short.

Apparently, there is a limit to the size of feeds that will run. So chopping your feed into time periods lets you get around that problem, if you want your blog journey to be complete.

There's a bit more about that issue in this post, which I will revise as I learn more.

In the mean time, note that my Full-and-Jump-Break pipe now has start and end date fields.

Feeding your content through the pipe

Assuming you want to implement my blog-journey hack badly enough to have set up a feed and read an introduction to Yahoo Pipes: don't turn back now.

Here is the quick-and-dirty.
  1. Go to the pipe for my hack.
  2. If you've set your feed to Short, use Blog Journey (Short); if Full or Jump-Break, Blog Journey (Full or Jump Break).
  3. If you are using a Short feed, make a clone of the pipe--this will create your own editable copy of the pipe in your account. You will be prompted to log in to Yahoo or create a Yahoo account. (Sorry!)
      You don't need to do this for the other feed types or if all you are after is a list of your blog-post titles. (Short vs. Full vs. Jump Break here.)
  4. Put your feed url in the little box where indicated.
  5. Run the pipe to see what you've done.
  6. Click "Get as RSS" and pay no attention if you then see an incomprehensible babel of code. (Some browsers don't format the feed, but it doesn't matter.) That is not intended for human eyes.
  7. What you are after is the url (the web address in your browser bar) for that page. Copy it and port it over to a handy rss-to-JavaScript converter.
There is sometimes an additional step. Pipes sometimes generates RSS-feed urls that begin with "feed://" instead of "http://"

If this happens to you, correct the feed by deleting and replacing "feed://" with "http://" and paste that into the rss-to-JavaScript converter.

Update: The pipe for Full and Blog-Journey feeds now has an option for start and end dates to let you segment your blog journey by date. Read about that here.

Fall 2011 Update: Yahoo has tinkered with Pipes in a very unhelpful way. If you have, or expect to have, more than 100 posts in your blog, see this post for a description of the problem and workaround.

Slicing and Dicing with Yahoo Pipes

Perhaps the strangest part of my blog-journey hack entails sending your blog feed through Yahoo Pipes.

Pipes is a free web-based service for mixing and manipulating feeds. Working on the (imperfect) metaphor of your feed as a flow of content, users construct a "pipe" that channels and changes the elements of that flow--for instance, sorting them chronologically.

That's what we are here for, but the pipe I built does more than that. You do not need to build your own--use mine.

Unfortunately, if you use the Short feed you will probably need to use or set up a Yahoo account so that you can make an editable copy of my pipe. I will tell you how to tweak your copy.

Before you do that, you should check out Yahoo's introduction to Pipes.

If you have the soul of a hacker, Pipes will dazzle and inspire you with possibilities. If you don't, I'll at least try to make my explanation (next) as painless as possible.

Feed types: Short versus Full versus Jump-Break (versus just titles)

A feed broadcasts your blog posts to subscribers, either the entire blog post (if you set up Full feed) or the first 250 characters or so (if you set up Short feed).

My blog-journey hack is based on using a feed of your blog, so if you want to show your content in chronological order, you have to chose one of those two options.

Full Feed
Pro: Retains hyperlinks and character formatting. Easiest to set up and maintain as blog-journey page.

Con: Sends all of each post to your subscribers.
Short Feed
Pro: Makes short “teaser” lead-ins to your actual posts. Less scrolling on your blog-journey page.

Con: Blog-journey page more work to set up & maintain. Some formatting is lost.
Jump-Break Feed
Pro: User sets cut-off point for each post. Preserves all formatting and blog-journey is as easy as for the Full feed.

Con: Compared to Short feed, can make a longer and bigger Blog Journey page; break (if any) must be set for each post.

Set your choice on Blogger, at Settings > Site Feed > Allow Blog Feeds.

Getting your feed

My blog-journey hack is based on manipulating and formatting a blog feed.

There's a lot you could know about feeds, and I'm no expert. Here's a primer and some resources sufficient for hack purposes.

A feed takes your blog content and squirts it over the internet to feed subscribers.

The subscribers may view the feed in many different ways that should not concern you. As a blogger, you only need to decide (1) whether to allow feeds of your blog at all and (2) if so, how much of your content to include in the feed.

The settings for your blog feed are at Settings > Site Feed and you can chose from "None," "Short," "Until Jump Break," and "Full." Short will truncate each post in your feed at about the 250th character, which is useful if you write good lede paragraphs. "Until Jump Break" lets you decide where to truncate each feed posts.

If your goal is to reproduce every word of every post in your blog in chronological order, you need to pick "Full." You can change this setting at any time.

There are other advantages and disadvantages to each. More about this choice here.

Blogger has this handy help page about feeds.

Once you've enabled your feed you can view it at its own url as follows. (Substitute your blog name from your blog url for "YOURBLOGNAMEHERE.")

This is the url that you will send through Yahoo Pipes.

Update: If you burn your feed at Feedburner (or elsewhere), read this.

Wednesday, May 19, 2010

First things first: putting your blog in order

A new method for showing blog content in chronological order.

Update: I am sorry to say that this method no longer works because of the demise of Yahoo Pipes, a web service that allowed bloggers to sort their blog feed.

It was, briefly, the state of the art, in a mad-scientist sort of way.

There are still several other valid, if unintuitive, ways to show blog content in chronological order.

This hack was my first venture into messing around with Blogger's plumbing. It was Rube Goldberg, it was spit-and-chickenwire; it was in every way too clever by half, and now it has suffered the final fate of all things clever in that way. 

I will indulge my sentimentality by not deleting the many posts I sweated over back in 2010, but they are useless to you. If you want to reorder your blog posts, check out one of the remaining methods

Blogging is classically about the Latest Thing, featuring the most recent post first. Scroll down to read everything backwards.

For bloggers, however, blogging is also a journey, and some would like to be able to show their content that way, in chronological order.

The standard method for doing this is to edit the post date, which controls the order that posts appear, giving all posts fictitious dates to achieve the desired order. This does the job but might be unsatisfying for a number of reasons.

I've worked up an alternative method that might appeal to some bloggers.

Update: There are now a number of ways to do this and mine is not necessarily the best. Read this post for a comparison of leading blog-journey hacks

In a nutshell my workaround entails the following steps:
  1. publishing your blog as a feed;
  2. using Yahoo Pipes to re-order the feed and introduce some formatting elements, then publishing that as a second feed;
  3. using a service like to convert the feed to javascript
  4. Pasting the javascript code on a static blog page (that part is easy)
  5. Adding some custom CSS to your blog's template to format the elements of the feed as they are rendered on the static page.
This solution entails multiple steps and may include some unfamiliar methods, but if you are game I have done most of the work for you and will guide you every step of the way. No knowledge of javascript is required; it's all done for you.

For an example of what is possible using this method, see (a) the "journey" page of this blog (unformatted) or (b) of my "real" blog (formatted).

You might also prefer just a list of your blog posts in order, which is simpler still.

Further explanation in subsequent posts.

Update: As of 2012, there is another method for flipping blog-post order that is very promising. Interested bloggers should check it out.

I am just a blogger, not some uber-hacker, and would like to thank the Yahoo Pipes help forum and also Vin, a technically astute blogger who generously gives advice on Blogger's help forum from time to time. Vin first told me about Yahoo Pipes (for a much simpler application) a few years ago.

Final note: This was a lot of work, and I hope Blogger will continue to allow bloggers to post javascript code into our blogs.

On the other hand, I am sure that Blogger could implement a blog-journey option that would knock the socks off this hack in terms of flexibility and ease of use, and I would not resent it at all if they did so.

Next: Getting your feed