CS Nuglet: Adding a new Location in SiteUrls_Override.config

The _Override.config architecture in Community Server is a sweet thing, allowing customization of both the CommunityServer.config and SiteUrls.config without touching the source files.  Using the XPath Override logic is usually pretty straightforward, but sometimes it can get a little tricky.  Today I wanted to create a new SiteUrl location in a SiteUrls_Override.config file, a Nuglet Worthy endeavor because I couldn’t find another example of it anywhere.

What I mean by “location” is that the SiteUrls.config file contains several “location” areas: Blogs, Forums, Media, etc., each typically mapped to a corresponding /themes/[SomeTheme]/[Folder].  I needed to create a number of new pages, but rather than add them in /Common or some other existing folder I wanted to place them in their own theme subfolder, which I’m calling “Shared.”

This is how I added the new location in the SiteUrls_Override.config.

<Override xpath=”/SiteUrls/locations/location” mode=”update” where=”end”>
    <location name=”shared” path=”/” themeDir=”Shared” >
       <url name=”shared_Calendar” path=”” pattern=”calendar.aspx”
           physicalPath=”##themeDir##”  vanity=”{2}” page=”calendar.aspx” />
       <url name=”shared_Maps” path=”” pattern=”maps.aspx”
           physicalPath=”##themeDir##”  vanity=”{2}” page=”maps.aspx” />
          …..
    </location>
</Override>

The resulting pages would be stored in /themes/mytheme/Shared with the urls

     http://mysite.com/calendar.aspx
     http://mysite.com/maps.aspx

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.