In Valid Logic

Endlessly expanding technology

How To: Single Blog/Gallery Site Configuration

Updated: This method is vastly out of date.  It was only for Community Server v1.0.  Please see http://qgyen.net/archive/2006/07/14/Qgyen.ExtendedUrlMapping-for-CS-v2.1.aspx for the new method in CS v2.0 and v2.1.

Community Server was designed around the idea of multi-user community featuring forums, blogs, and photo galleries.  This is a great and easy setup for people running community sites, but there are still a lot of people who run their own personal site and want the same blog/gallery functionality.

The purpose of this article to show how to configure Community Server to run utilizing only a single blog and gallery.  This should also show easy it is to do simple customizations utilizing the Community Server framework.  Configuring a single blog/gallery can be done in only 7 simple steps and utilizing a customized SiteUrls.config file

Downloads

Download the following file: singlesite.zip

Instructions

  1. Create the blog and gallery you want to be your primary blog/gallery.  Go to the Admin area, click on either Blogs or Galleries, and go to Manage Blogs/Manage Galleries.  Create a blog named something like “Blog” and Gallery named something like “Photos”.  After creating your blog/gallery, you will want to click on it and take note of the "Blog Name" field in Blogs and "Application Key" field in Galleries.  You will need this later.

  2. Overwrite the SiteUrls.config file in your Community Server directory with the one included in the zip..

  3. Open up the SiteUrls.config and configure the folder you want your blog/gallery to be accessible from.  Look under “locations” for the “weblogs” and “galleries” entries.  Change them to your wishes.  The default in the included file is /blog/ for your blog, and /photos/ for your gallery (/photos/ is the default in Community Server for a multi-user site as well)..

  4. Rename the blogs and photos folder in your Community Server directory to match the settings in the SiteUrls.config.  If you are using the default settings included in the file, just rename the “blogs” folder to “blog”..

  5. Copy the included sample_web.config to the /photos/ directory, name it web.config, and open it up.  Change the value for the “ApplicationKey” entry to match the Application Key setting for your photo gallery..

  6. The blogs already has its own web.config, so copy the section from the sample or from the gallery file and paste it into the web.config in the blogs directory.  Change the value for the “ApplicationKey” entry to match the Application Key setting for you blog..

  7. Open up the root level web.config and find the <httpHandlers> section.  Any entries with a path starting with "blogs/" or "photos/" should be changed to reflect the directories you used in step 4.  These are used for RSS feeds and the Metablog API support for the blogs.

Background

Customizing Community Server in this way is achieved by modifying its URL schema to remove the directory level from the URLs that normally specifies which blog/gallery to load.  If you compare the SiteUrls.config entry for “gallery_ViewGallery” from the default file and the included file, you will notice a few differences:

  • The path attribute is missing a {0} parameter which was a directory.
  • The pattern attribute is missing a ([\w\.-]+) section which was used in the regular expression to grab the Application Key.
  • The vanity attribute is missing the “App=$1” section, which was used to pass the Application Key to the page that handles the rewritten URL.

This affectively changes Community Server’s URL rewriting to no longer specify which blog/gallery to load.  It will no longer look for the Application Key in the URL the user uses the access the site, and the Application Key will no longer be included in links generated by Community Server itself.

Since one is no longer specified using the URL, we still need to tell Community Server which one needs to be loaded.  This is where the web.config file comes in.  In the absence of a “App” setting in the query string, Community Server will fall back on reading the ApplicationKey from the AppSettings section of the web.config.  These files are placed in both the blog and photos directory in order to narrow their scope to just the blog and photos areas.

Tuesday, February 01, 2005

 
blog comments powered by Disqus