Category: <span>Macros</span>

Doc Searls, Sam Ruby, and Jonathan Peterson are all pointing at Dave Sifry’s Google API hack for Moveable Type.

Sifry writes: “Look down at the bottom of this blog entry. You’ll see a line that starts, ‘Related Stories:’ followed by 10 links. These links are created by a google search on the words in the title of this blog entry.”

It turns out that this is pretty easy to do in Radio as well. As a test, I created a macro called googleTitleSearch, which you can drop in your Macros folder. With the addition of a snippet of code to my item template, I now have the top 10 Google results for the title of my weblog posts.

If you want to try it out, here’s how:

Note: You must first create an account with Google, and configure Radio to use the key associated with your account. Follow steps 3 and 4a on this page to get your key.

If you want something simpler that doesn’t require signing up with Google, you might try out the googleIt macro.

1) Download googleTitleSearch.txt to your Macros folder. (It’s a sub-folder of your Radio UserLand program folder.)

2) Edit your item template, adding the following macro to the template, where you want the search results to appear:

<%local (adrpost = @weblogData.posts.["<%paddedItemNum%>"]); return (googleTitleSearch (adrpost))%>

(Be careful to make sure that the macro appears on a single line in your template. Line-breaks in the macro will cause an error on your page.)

3) Make sure that the preference for Item-level Title and Link is checked.

4) Create a new post, with a title. Click the Post button.

That’s it. For any posts that have a title, you’ll get a Google search result for the words in the title, along with your post.

Jake's Radio 'Blog Macros

Comments closed

Day 8 of Mark Pilgrim’s “30 days to a more accessible weblog”: Constructing meaningful page titles. Mark writes:

“Every page of your weblog should have a unique and meaningful page title… Date-based archive pages should include the name of your weblog, followed by the date (or date range) for the page…

“Unfortunately, I do not know how to customize page titles satisfactorily in Blogger or Radio. Radio has a <%longDate%> macro, but it can not be used as part of the page title…”

It’s true that longDate doesn’t work in the template, but there is a way to do this. Here’s how:

1. Edit your home page template.

  1. Find the line (probably near the top) which reads:

<title><%title%></title>

  1. Between <%title%> and </title>, add the following macro:

<%local (d); if radio.weblog.file.getArchiveFileDate (radioResponder.fileBeingRendered, @d) {": " + string.dateString (d)} else {""}%>

Note: be careful if you copy and paste this code — there should be no line-breaks.

  1. Click the Submit button.

The next time any of your archive pages are published, they’ll have a date in their title.

There’s no need to stick with the default date format. You can format the date however you want — Just replace the string.dateString (d) part with your own code. See the DocServer pages for the date and string verbs for some places to start digging.

Jake's Radio 'Blog Macros

Comments closed

Mikkel Bruun asked on the Radio UserLand discussion group how to get a 24-hour time-stamp on his weblog posts. Here’s a macro for the item template, that returns a 24-hour time stamp. Use it in place of the <%when%> macro:

Jake's Radio 'Blog Macros

Comments closed