* Support short URLs (http://server/wiki/Page instead of

http://server/w/index.php?title=Page).

svn path=/nixos/trunk/; revision=18783
This commit is contained in:
Eelco Dolstra 2009-12-03 13:34:36 +00:00
parent aacd16cff0
commit 4eabed3f0f

View File

@ -49,6 +49,14 @@ let
$wgSitename = "${config.siteName}";
${optionalString (config.logo != "") ''
$wgLogo = "${config.logo}";
''}
${optionalString (config.articleUrlPrefix != "") ''
$wgArticlePath = "${config.articleUrlPrefix}/$1";
''}
${config.extraConfig}
?>
'';
@ -95,6 +103,10 @@ in
Allow from all
DirectoryIndex index.php
</Directory>
${optionalString (config.articleUrlPrefix != "") ''
Alias ${config.articleUrlPrefix} ${mediawikiRoot}/index.php
''}
'';
options = {
@ -168,14 +180,29 @@ in
description = "Name of the wiki";
};
logo = mkOption {
default = "";
example = "/images/logo.png";
description = "The URL of the site's logo (which should be a 135x135px image).";
};
urlPrefix = mkOption {
example = "/wiki";
default = "/wiki";
default = "/w";
description = ''
The URL prefix under which the Mediawiki service appears.
'';
};
articleUrlPrefix = mkOption {
default = "/wiki";
example = "";
description = ''
The URL prefix under which article pages appear,
e.g. http://server/wiki/Page. Leave empty to use the main URL
prefix, e.g. http://server/w/index.php?title=Page.
'';
};
extraConfig = mkOption {
default = "";
example =
@ -207,5 +234,13 @@ in
) | ${pkgs.postgresql}/bin/psql -U "${config.dbUser}" "${config.dbName}"
fi
'');
robotsEntries = optionalString (config.articleUrlPrefix != "")
''
User-agent: *
Disallow: ${config.urlPrefix}/
Disallow: ${config.articleUrlPrefix}/Special:Search
Disallow: ${config.articleUrlPrefix}/Special:Random
'';
}