WebReference.com - Part 2 of Chapter 7 from Essential Blogging. From O'Reilly (5/5). | WebReference

WebReference.com - Part 2 of Chapter 7 from Essential Blogging. From O'Reilly (5/5).

To page 1To page 2To page 3To page 4current page
[previous]

Essential Blogging, Chapter 7: Advanced Radio UserLand

Listing Recent Posts

People who read your blog will vary from everyday readers to occasional browsers. If you blog frequently, you may find that those occasional readers are penalized by the sequential, newest to earliest, nature of blogs. To make this easier for readers, you can add the Recent Posts macro to your blog. The Recent Posts macro lists the titles of recently added posts. You must have titles enabled (see Chapter 4) to use the Recent Posts macro. Figure 7-9 shows the Recent Posts macro in action.

Recent Posts macro
Figure 7-9:
Recent Posts macro

Like many Radio macros, the Recent Posts macro (actually called radio.macros.recentTitledBlogPosts) can be called with parameters. In the case of this macro, the parameters specify how many posts to display, whether to truncate titles, and so on. The five parameters, all of which are optional, are listed with their default values in Table 7-1.

Table 7-1: Parameters to the Recent Posts macro

ParameterDefault ValueMeaning
maxPosts25Maximum number of posts to display
maxTitleLength(infinite)Maximum length of title (titles will be truncated to this length)
flIncludeWhentrueList the dates of the posts as well as their titles
Catname""Category of posts (empty string means all)
cellSpacing0Cell spacing for the table

So to display a Recent Posts list, but truncate the titles at 50 characters, you'd use:

<%radio.macros.recentTitledBlogPosts (maxTitleLength:50)%>

To raise the number of posts to 50:

<%radio.macros.recentTitledBlogPosts (maxPosts:50)%>

To add 5 pixels between each line in the post lists and between the title and the data (i.e., set the cellspacing attribute of the HTML table that displays the posts):

<%radio.macros.recentTitledBlogPosts (cellSpacing:5)%>

To give 10 posts a title length of 50 characters, with no dates and 5 pixels of cell spacing:

<%radio.macros.recentTitledBlogPosts (maxPosts:50, maxTitleLength:50,
flIncludeWhen:false, cellSpacing:5)%>

To add this macro to your template underneath your calendar:

  1. Update your Radio.root file as described earlier in Chapter 3.

  2. Click on the Prefs link in the Radio command bar.

  3. In the Templates group of links, click on the Home Page template.

  4. Find the call to <%drawcalendar ( )%>.

  5. Add the Recent Posts macro after the call to drawcalendar. Exactly where to put it in the HTML depends on the template you're using. For example, in the Default template, the calendar is part of a table with your navigation links and various Radio and XML icons. In this case, it's best to put the Recent Posts list outside that table. In the Woodlands theme, the icons and links are elsewhere, so you can simply put the Recent Posts macro call immediately after the drawcalendar call.

    <%radio.macros.recentTitledBlogPosts (maxTitleLength:50)%>
    
  6. Click on Submit to save your template.

Reload your blog's home page and you should see the Recent Post list. Figure 7-10 shows the Recent Posts list added to the Default theme.

Calendar and recent posts
Figure 7-10:
Calendar and recent posts

If you find that the macro's output doesn't appear on your blog, one of two things is probably wrong. An error message from Radio probably indicates a syntax error-check that you haven't mistyped the % characters or mistyped the macro or its arguments. If you just don't see a change, your changed post probably hasn't been upstreamed yet-wait a few seconds and try again. If it still doesn't work, check your network connectivity and look at the Events log in Radio.

Additional Macros

There are many different macros for Radio templates: some from UserLand, some from individual developers, and some from third parties. Different types of macros include the very popular GoogleBox, picture galleries, image uploaders, and more. Locate these macros via these directories:

https://radio.userland.com/directory/6742
https://ruminations.weblogger.com/directory/143

Creating and Downloading Themes

Although adding macros to an existing Radio template is relatively easy if you are comfortable with HTML, it is actually quite difficult to create an entire theme. A third-party product for Radio, themeTool, lets you create your own themes using standard web development tools such as DreamWeaver or FrontPage. More information is available from:

https://radiotools.evectors.it
https://radio.userland.com/stories/storyReader$7024

To page 1To page 2To page 3To page 4current page
[previous]

Created: October 14, 2002
Revised: October 14, 2002

URL: https://webreference.com/authoring/blogging/chap7/2/5.html