Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Can you add a hyperlink to the Author field?

I'm trying to create a site that when you generate articles it also lists authors.  The author names should either be clickable to a bio page or to a mailto: link.

Has anyone done this

Eugene Chan
Thursday, January 10, 2002

You could certainly list the authors with links in an extra field.  I don't think that quite gets it though.  Or you could script through your "author bio" folder the sidebar of an article template - that is, list all the authors in the side bar of every article.  I don't think that's quite it either.

When you try to add a link to something on the properties view of an article,  All you can do is "insert a link from teaser or headline to main article."  It will add [[ ]] to the author field but that just ends up linking back to the article.

It made me want a select box for authors and keywords that allowed you link to "about the author" article.

I'll bet y'all have some better ideas.

Terry Kearns
Thursday, January 10, 2002

One way to do it is to set up a variable for every author that links to their bio.

* make a folder to put all the bios into
* make an article for each author in this folder
* make a variable for each author, for example,
EugeneChan would be <a href="PTMFOG0000000012">Eugene Chan</a>. The way I got "PTMFOG0000000012" was by right clicking on Eugene's bio article and saying "Copy Magic Name".
* Now in the Author field, Eugene puts {$.EugeneChan$}
* If a given author doesn't have a bio but only has a mailto, you just change their variable to <a href="mailto:blah@blah.com">Author's Name</a>

A small, simple CityDesk site which illustrates this with three authors can be downloaded from
http://www.joelonsoftware.com/RandomStuff/authorbio.zip

It's not super elegant. We'll have to do something about this since it's not an unusual request. I'll put it on the list.

Joel Spolsky
Thursday, January 10, 2002

While this solves the immediate problem, there is one small issue - I think this will prevent the Author field of articles from being used in loops (e.g. on index pages), since CityScript doesn't expand variables n levels deep.

Darren Collins
Friday, January 11, 2002

CityScript doesn't expand n levels deep? Well, it at least goes two levels. :)

I use multi-level expansion on almost every page... I wonder if I'll run into problems if I go another level.

Brian St. Pierre
Wednesday, February 13, 2002

I use a combination of the above approaches. I stick the author's name in the author field.  I also create a {$.AuthorName$} variable contains a hyperlink to the author's bio in the AuthorBios folder. 

But, I put {$.AuthorName$} in the About the author field, not the Author field. 

Now outputing {$.about$} after the article title creates a link to the author's bio page.  And on the author's bio page, I create links to all the author's articles like this:
{$foreach x in (author "Author Name") $}
<A href="{$x.link$}">{$x.headline$}</A></P>
{$next$}

For me it is the best of both worlds.

David Burch
Sunday, January 05, 2003

*  Recent Topics

*  Fog Creek Home