Feature Proposal: Add configuration parameter {HomeWebName}

Motivation

Whenever no web name is specified the {UsersWebName} is used as a default. However that might not be a desirable choice for sites that want to store the main site in the Main web while separating out the user profiles in a Users web (for example). Now, when the site is accessed via http://mysite.com will Foswiki default to Users.WebHome. However it should render Main.WebHome instead.

This is desired outcome is possible to implement using HomePagePlugin by setting {HomePagePlugin}{SiteDefaultTopic}. This will be used when accessing the site's root. Any other api calls to normalizeWebTopicName will still default to {UsersWebName}.

A common approach is to add a redirect to the web-servers config from / to /Main/WebHome (or wherever the main site is located). Problem is that this adds YARE (yet another redirect) also known as DBR (death by redirects). This is directly affecting the SEO scoring of a site. A web-server already may have been redirecting a couple of times, e.g.

  1. http://mysite.com
  2. https://mysite.com
  3. https://www.mysite.com
  4. https://www.mysite.com/Main/WebHome

The first three can be fixed in the web-server config already. Not so the last one. Every redirect we can omit is good for the site in terms of SEO.

Basically, this is a clean-up of the api. Defaulting to {UsersWebName} totally makes sense in a standard setup, not so as soon as you set {UsersWebName} to some other value in an attempt to separate a main site from all user profiles.

As per discussion on the release meeting we decided to invent a new %HOMEWEB% macro as well. All links in the System web will be changed similarly from

%SCRIPTURL{"view"}%/%USERSWEB%/%HOMETOPIC%

To

%SCRIPTURL{"view"}%/%HOMEWEB%/%HOMETOPIC%

All use of %USERSWEB% and {UsersWebName} is reserved to only refer to the web where the user profiles are located. Nothing else. This also means that defaults generated in Foswiki.spec will be changed from

$Foswiki::cfg{LocalSitePreferences} =  '$Foswiki::cfg{UsersWebName}.SitePreferences';

to

$Foswiki::cfg{LocalSitePreferences} =  '$Foswiki::cfg{HomeWebName}.SitePreferences';

Description and Documentation

Desired outcome is to move implement a {HomeWebName} configuration parameter that defaults to {UsersWebName} but lets you separate it out and use it as a proper default potentially different from the {UsersWebName} setting. HomePagePlugin will have to be adjusted to take {HomeWebName} into consideration while processing its own {HomePagePlugin}{SiteDefaultTopic}.

This also adds more flexibility to those that don't like HomePagePlugin for whatever reason.

Examples

Impact

Replace {UserWebName} with {HomeWebName} in:

  • lib/Foswiki.pm
  • lib/Foswiki.spec
  • lib/Foswiki/Func.pm

Implementation

-- Contributors: MichaelDaum - 19 Apr 2016

Discussion

 
Topic revision: r4 - 06 May 2016, MichaelDaum - This page was cached on 24 Nov 2017 - 03:05.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License