Junkfood

Food and Junk.

All | Food | Junk | Work

20050125 Tuesday January 25, 2005

Example of Improved Permalink Format

(2005-01-25 09:40:49.0) Permalink |

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]

Calendar

« January 2005 »
SunMonTueWedThuFriSat
      
1
2
3
4
5
6
7
8
9
10
13
15
16
17
22
23
26
28
29
30
31
     
Today

Recent Entries

Search

Navigation



XML