The Site Directory in Moss is very useful when it comes to categorize and sort your sites. If you are using the Site Directory in your environment you might know that by adding Columns to the Sites list in the Site Directory site, columns will show up on the Create New Site page. This is a very good thing since it forces you to fill in the necessary metadata about the site. For instance in this example each site in the Site Collection will be holding all the information about a specific customer. By adding a column in the Sites list we can upon creation of sites add information about which service the customer is using and then later sort and group them by that same metadata.

The picture below shows how it looks with custom fields in the Create New Site page.

 createsiteinsitedirectory

What also happens automatically is that all the choice fields will be listed as links were you by clicking on them get a search result with all the, in this case customers. But unfortunately this only happens if the field is a choice field added to the list, not even if you have a Site Column or Lookup field it shows up on your Site Directory page. You might also in some cases avoid having choice fields directly on the Sites list because in the name changes, it will not change on all sites automatically. In that case you need to have a lookup field, and as mentioned that does not automatically appear on the Site Directory page. So what if you want to have your other fields searchable in the same way? Well, it’s possible with some good old html.

Below you see that we only have the two choice fields to choose between.

site-directory-category

But before we create our custom category with links, let us analyze what happens when clicking on any of the existing categories. The page that the link takes us to is the categoryresults.aspx located in the Pages directory. So let take a look at the querystring:

categoryresults.aspx?Column=DivisionMulti&ColumnDisplayName=Division&Value=IT%20Services

The querystring field Column is the column that SharePoint will search in, and what you need to know is that it’s the columns internal name and not the display name that needs to be put in here. So if you have create a lookup field named Service you just change the “DivistionMulti” to Services. The next querystring value is the display name, and in this case that means that it’s simply that value that will be printed out on the page to show the end user what they search for. And in the last querystring value, named Value you type the value you want to search on.

The final result will look like this:

categoryresults.aspx?Column=Service&ColumnDisplayName=Service&Value=SomeService

So, let’s go to the Site Directory page, select Edit page from the Site Actions drop down and add a new Content Editor Web Part. Now, it’s all up to you to populate and to style it your way. If you want (and why shouldn’t you?) to have the same style, take view source on the page and you will find the right style classes used.

Yes, this will make you have to manually update the categories if they change but, by experience they don’t change that often and this is a quite solution that don’t involve any custom web parts.

Below you see the final result and one screenshot on the page in edit mode.

sitedirectorycustomcategoryeditpage

sitedirectorycustomcategory



  1. Gaurav (Reply) on Wednesday 18, 2009

    Thanks for the article.

  2. Tara (Reply) on Wednesday 18, 2009

    The pictures seem to be missing…

    • Mattias Karlsson (Reply) on Wednesday 18, 2009

      Thanks! Looks like It missed a few posts when I changed to WordPress. Think the pictures should be there now.