Click here to show or hide the menubar.

Home >  Archive >  2010 >  June >  23

Previous / Next

Improving paragraph-level permalinks
By Dave Winer on Wednesday, June 23, 2010 at 9:35 AM.

I'm back in NY, after returning from Calif where I sold my house. Now it's time to get back to my real job -- writing a new blogging tool called Scripting2. permalink

To get the ball rolling, I'm going to make paragraph-level permalinks work a little beter. permalink

In their first incarnation, implemented a few years ago, a pargraph would get a unique name derived from its timestamp which was converted into a number to make the name. So if this paragraph was created at 12:28:08 PM today its name would be "p934826408.' It works, but it's pretty unsightly.  permalink

In the next iteration the names were a bit nicer. As it was rendering the story it would bump a counter each time it moved to a new paragraph. So the names would be p1, p2, etc. The only problem is if I added a paragraph in the middle, all the numbers would move down and links might point to the wrong place, which defeats the purpose of having the permalinks. permalink

So now I'm doing it a better way that has less distracting names than the original approach, but won't break if paragraphs are added in the middle. permalink

When I create a new paragraph I give it a serial number. So the first paragraph in a story might get serial number 249, and the second would be 250, and so on. The corresponding names would be p249 and p250. Later if I add a paragraph between them, it could be 284. The numbers would appear to be out of sequence if you looked closely, but they would remain unique.  permalink

In fact this post was written using the new system. If you're reading this on the web and not in a feed reader, try hovering over the purple pound signs at the end of each paragraph. A paragraph was added in the middle. See if you can find it! permalink

BTW, the serial numbers are reflected in the OPML that's linked into the HTML rendering and the RSS feed, so if you're writing an alternate viewer for my posts, you can use the serial numbers in generating your paragraph-level permalinks. permalink

For example, here's the OPML generated for this post. permalink

RSS feed for Scripting News
This site contributes to the community river.

© Copyright 1997-2012 Dave Winer. Last update: Wednesday, June 23, 2010 at 9:51 AM Eastern. Last build: 8/26/2012; 5:48:25 PM. "It's even worse than it appears."

RSS feed for Scripting News

Previous / Next