Junkfood

Food and Junk.

All | Food | Junk | Work

20050125 Tuesday January 25, 2005

Roller: Improved Permalink Format

In most blogs I've seen, a Permalink for an entry is a URL that points to a page containing just that entry, along with that entry's comments. However, Roller uses Permalink URLs that contain a date and point to a page containing all entries from that date and earlier (containing the entry specified, along with a whole bunch of other entries). This is so, even though Roller already has the capability to generate pages that look like "standard" Permalink pages.

If you look at the URL for any Roller blog entry's "Comments" page, you'll see that it is very similar to a "standard" Permalink URL. And, if you follow the Comments link, the resulting page looks very much like a "standard" Permalink page. In fact, if we take a Roller comments page URL and simply remove the "#comments" anchor from the end, it makes a pretty good alternate Permalink.

The below macro overrides the standard Roller macro for generating Permalink URLs, to use the alternate format. The diff is also below. Because I do not know whether overriding the Permalink URL format might have any side effects (within Roller or for outside agents/aggregators), I have not implemented it on my blog. (I have tested it, and it appears to work just fine.) This macro needs to be put in the "_day" template. Putting it in the "Weblog" template does not work.

#macro( showEntryPermalink $entry )
    <a href="$ctxPath/page/$userName/$page.link/$utilities.encode($entry.anchor)"
        title="$text.get( "macro.weblog.entrypermalink.title" )"
        class="entrypermalink">Permalink</a>
    #if ($pageHelper.isUserAuthorizedToEdit())
        [<a href="$pageHelper.getEntryEditUrl($entry)">
        $text.get( "macro.weblog.entrypermalink.edit" )</a>]
    #end
#end

2c2
<     <a href="$baseURL$entry.permaLink"
---
>     <a href="$ctxPath/page/$userName/$page.link/$utilities.encode($entry.anchor)"

(2005-01-25 09:24:00.0) Permalink | Comments [3]

Comments:

Cool -- a shorter URL would look even better... ;-)

Posted by 195.176.20.45 on January 25, 2005 at 02:15 PM EST #

I assumed that "official" Roller URLs contain the function "page", "comments", or "trackback" in the middle and the page template name "Weblog" at the end of the URL. At least, these are the URL forms that the software produces. I do not know enough about the internal workings of Roller or the Apache config to know whether the shortened forms are the best ones to use for Permalinks. As far as I am concerned, there are way too many URL variations.

Posted by junkfood on January 25, 2005 at 04:35 PM EST #

I don't know why "comments" was added to "page" (they do the same thing), but "trackback" is specifically and only for trackback calls. The shorter version that Anonymous posts looks to be related to a specific Apache config on blogs.sun.com; I can't do that on my personal installation.

Posted by Lance Lavandowska on January 27, 2005 at 05:08 PM EST #

Post a Comment:

Comments are closed for this entry.

Calendar

« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today

Recent Entries

Search

Navigation



XML