When dealing with hyperlinks in SharePoint, users often point out the two following limitations:
- in a links list, there is no option to open a link in a new window.
- When using calculated columns to build URLs, the result is not displayed in a user-friendly way.

There are various methods to work around these limitations. Today I am going to show mine, which has the advantage of only using the SharePoint UI (no need for SharePoint Designer).

The issue

To understand the issue, let’s build a list of links pointing to the Microsoft SharePoint newsgroups:
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.design_and_customization
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.development_and_programming
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.general
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.setup_and_administration

First, we create a custom list (Site Settings > Create > Custom list), call it “Microsoft newsgroups”, and add these four items:
sharepoint.design_and_customization
sharepoint.development_and_programming
sharepoint.general
sharepoint.setup_and_administration

The second step is to create a calculated column to build the links to the newsgroups:
Name: “URL”
Type: Calculated column
Formula:

= CONCATENATE ("http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.", [Title])

Let’s take a look at the result:

As expected, we have been able to build our URL, and the browser has interpreted it as a hyperlink. But the display is not very user-friendly. We’d prefer to just see the titles, for example “sharepoint.general”.

Building an user-friendly list of links

To achieve this result, I am going to apply to the above list my method: using calculated columns to write HTML.

This is the HTML I need (Title displayed, and on click open URL):
<DIV><a href=”URL”>Title</a></DIV>

So in SharePoint I am going to change the [URL] formula to this:

=CONCATENATE("<DIV><a href='","http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.",Title,"'>",Title,"</a></DIV>")

Now, the final touch: add the script to convert the string to HTML (how?), and you should now see this:

What is still missing is the option to open the link in a new window. Here are the steps:
- create an additional column in your list:
Name: “Open in new window?”
Type: Yes/No (check box)
- change the formula in the URL to this:

=CONCATENATE("<DIV><a href='","http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.",Title,IF([Open in new window?]=TRUE,"' target='_blank' ","'"),">",Title,"</a></DIV>")

Here is the final formula in clear (but you should actually copy/paste the above one):
=CONCATENATE(”<DIV><a href=’”,”http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.”,Title,IF([Open in new window?]=TRUE,”‘ target=’_blank’ “,”‘”),”>”,Title,”</a></DIV>”)

As usual, feedback is welcome!