Create Short (Readable) URLs for Views

Mindwatering Incorporated

Author: Tripp W Black

Created: 09/24/2004 at 10:43 AM


Notes Developer Tips

There are several ways of creating friendly links. The most often used methods involved either saving the desired URL in a document field or adjusting a view column's formula to make the shorter, friendlier, URL.

Method One:
Use a variation of this method when you want the URL syntax to look very "friendly" so that no UNID strings are displayed to the user.

In the document create a key field, where the user types an "alias" for this document. The alias should be checked against all other documents' aliases. In a computed hidden text field, create the URL that the user will use. Show this URL in a view column. For the field use the following format:
{[ <a href=/"} + @WebDbName + {/ViewAliasName/} + KeyAliasFld + {">} + MyLinkText + {</a> ]}

ViewAliasName - the alias name of the view used
KeyAliasFld - the field where the alias was entered and validated
MyLinkText - the text the user clicks
The view should be formatted with the first column having the KeyAliasFld value sorted either ascending or descending.

Method Two:
Use a variation of this method when you may have attachments or other $File references or the number of documents precludes the ease of managing alias "keys" for retrieving the document.
Create a hidden sort column as the first column. Enter the field value appropriate for sorting the links displayed in the second column. Turn on this hidden column's property to "show values as links" (propeller hat tab). In the second column enter code similar to below. Make sure this column's "show values as links" is not enabled.
{[ <a href=/"} + @WebDbName + {/} + @Subset(@ViewTitle; -1) + {/} + @Text(@DocumentUniqueID) + {">} + MyLinkText + {</a> ]}

Note: For both of these examples, the [ followed with the < marks this text as paththrough HTML. Remove the spaces I haved to the above code lines when you begin using the code.

previous page