NOTE: I had to update the script at 3:40 PM on 3/18/2000; there was a problem with creating correct links for all of the news days on a home page with multiple days. It’s fixed now; you have to grab the script again, and look at #6 in the instructions below to use the new fix.
Lately, there’s been a move in the weblog world to be able to provide a link on each day’s page to that day’s permanent URL; that way, if someone wants to link to some wise (or not so wise) thing that you shared that day, they can do so explicitly.
Manila has always had permanent URLs for each day’s page, but unless you were a Manila user, you would have had to know this and know the format of the URLs. (Not that they’re hard…) I decided to write a small macro that you can include in your news template to do all this for you and your users. The macro is attached to this message (if you can’t see it, you may be in story view mode; switch to discussion group mode and you’ll see it in the header of the message).
What does it do?
It generates the proper link to a given day’s permanent page for your Manila site. By including it in your News Day Template (on the Advanced Prefs page), it will generate the proper link for every day, as it will appear in every day’s template.
What does it look like?
You can see it on this site. Go back out to the home page, and look in the bar that contains the date over every day’s entries. There’s a little P with a square around it at the right edge; hover over it, or click on it. That’s the link. You will see it on the news page for any day on this site.
How do I use it?
You either have to have your own Manila server, or your site has to be on a server that has implemented this macro and made it legal.
Here’s how to set it up on your own server:
- First, download the script from this message. The easiest way is to click on the fat page link in the message header above, and then save that page to your hard disk.
- Import the script into Frontier, by opening the fat page with the File/Open menu. You can save the script in one of two places: the #tools table of your Manila site, or the user.html.macros table of Frontier.root. If you save it in the former, then it will be available only to your specific Manila site. If you choose the latter, then it will be available to all Manila sites running on your server.
- Tell Frontier that the script is safe to run as a macro. You do this at config.mainResponder.prefs.legalMacros; inside this table, create another table named linkToDay. Within this new table, create two entries, both booleans — flLegal (set to true), and flParams (also set to true). (Userland has a page on safe macros here.)
- Go into your Manila site Preferences, and choose the Advanced pane. Scroll down to the News Day Template; this is where you should add the macro into your site, as it will then appear on every day’s page.
- Edit the template, adding in a call to the linkToDay macro. The syntax for calling the macro is {linkToDay(visible content of link, day to link to)}. (See below for examples.)
- You have to use a bit of trickery in the call to the macro; the second parameter should be “{newsPostTime}”. Manila will replace this with the actual date of the news page that’s being processed before it hands off the macro to Frontier to process; this way, each day on a multi-day home page will get the right link generated.
- Return to your Manila site home page, and see if it worked!
Examples
The one aspect of this macro that you can control is the visible text (or picture, or whatever) that represents the link to the user.
If I wanted my link to read “link to permanent address of this page”, then I would call the macro like this:
{linkToDay(“link to permanent address of this page”, “{newsPostTime}”)}
If I wanted it to have an image of a smiley face (that I had previously uploaded to the URL “http://me.com/smiley.gif”), then I would call it like this:
{linkToDay(“<img src="http://me.com/smiley.gif">”, “{newsPostTime}”)}
(Note the backslashes in that last example, escaping out the quotation marks so that the macro doesn’t think that I’ve ended the content that I want in my link.)
What if I find problems?
Then please, by all means mail me or post a reply to this discussion group message.
Update
Dave Winer added similar support to all Manila sites with the newsArchiveLink macro.
On your home page, the link for March 17th in the header is /2000/03/18. It looks like only the current day’s link “sticks”.
I wonder if there’s any way around that…
Jim
• Posted by: Jim Roepcke on Mar 18, 2000, 2:39 PMWow, I didn’t catch that — lemme work on it.
(It’s because the page is generated from a pagetable that is local to the topmost news on the home page — that is, the postDate for the whole page is the postDate for the topmost news date on the page.)
OK, it’s fixed, but it requires you to get the script again if you’ve already gotten it. It also requires another step when you are setting up your News Day Template; see the installation instructions.
/jason
• Posted by: Jason Levine on Mar 18, 2000, 3:24 PMExcellent work Jason! I forgot about the work around you used. Kinky!
I’d love to use that on my site…
Jim
• Posted by: Jim Roepcke on Mar 18, 2000, 4:38 PM