20031231 Wednesday December 31, 2003

Roller Tips: Titles as Permalinks and Category Display A few more tips for your Roller blog. You can edit your "_day" template to make your titles permalinks. I just added this feature to this site - try it now by clicking on this title for any post. To enable this feature, simply wrap your $entry.title element with a permalink URL. For example, change <b>$entry.title</b> to the following:

<a href="$baseURL/page/$userName?anchor=$entry.anchor" 
   style="font-style: bold; color: black">$entry.title</a>

Adjust the style as appropriate for your theme. The second tip is to add the ability for users to see the category you've posted to. Simply add the following under the $entry.title entry to display the category name in the top right corner of the post:

<span class="dateStamp" style="float: right">
    Category: $entry.category.name</span>

Again, the CSS for the span may depend on your theme. Lastly, if you click on a permalink for your blog and you're not routed to the specific entry you expect, for the love of God add the following before your $entry.title.

<a name="$entry.anchor" id="$entry.anchor"></a>

Posted in Roller at Dec 31 2003, 02:57:34 PM MST 7 Comments

Comments:

Infact, thanks to a tip from Sergio I used the $entry.category.name to display an icon for the relevent category.

Posted by Debashish on January 01, 2004 at 05:21 AM MST #

This may be kind of silly - but do you know how to retrieve the anchor part of the url in a jsp or servlet? I tried HttpServletRequest.getRequestURL(), but the "anchor" part is missing.

Posted by Will Gayther on January 01, 2004 at 08:55 PM MST #

Will, I believe that request.getQueryString() is what you're looking for.

Posted by Matt Raible on January 01, 2004 at 09:10 PM MST #

<p/>No, that really doesn't work. I want the anchor part - the part after the "#" sign. <p/>I made a simple jsp with one line: <%= request.getQueryString() %>
With a request url of "http://localhost:8080/testgeturl.jsp?bob=5&tom=4#someanchor"
The output is: bob=5&tom=4 <p/>Any other ideas? I assumed that perhaps the anchor wasn't sent with the html request...but obviously that isn't the case!

Posted by Will Gayther on January 01, 2004 at 10:02 PM MST #

Hmm, well, velocity runs under java, so it has to be in there somewhere, huh?

Posted by Will Gayther on January 04, 2004 at 10:43 PM MST #

To be honest, I don't have an answer for you. I just know that the anchor (everything after #) is recognized by browsers, but I don't know that there's any way to retrieve it using Java. You'd think it's possible, but I've never had a need to grab it.

Posted by Matt Raible on January 05, 2004 at 05:39 AM MST #

[Trackback] OK, so I've been hacking my template to pieces again, you will see some changes soon, but importantly for now, thanks to Matt Raible I have made the titles of each story their own permalink, as well as the little '#' down in the comments bar, which s...

Posted by Skip the Budgie on October 11, 2005 at 09:36 AM MDT #

Post a Comment:
  • HTML Syntax: Allowed
Click me to subscribe
Matt Raible is the Lead UI Architect at LinkedIn. The opinions on this site are mine, not my employers.
« November 2008
SunMonTueWedThuFriSat
      
1
2
3
6
7
8
9
10
11
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
      
Today

Recent Entries

Tag Cloud