Difference between revisions of "Personalize MediaWiki"

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 101: Line 101:
 
Edit MediaWiki:Common.css with:
 
Edit MediaWiki:Common.css with:
 
   pre { font-size: 100%; }
 
   pre { font-size: 100%; }
 +
 +
== Mobile-device detection ==
 +
http://www.mediawiki.org/wiki/Extension:MobileDetect
 +
<pre>
 +
## Default skin: you can change the default skin. Use the internal symbolic
 +
## names, ie 'vector', 'monobook':
 +
require_once("$IP/extensions/MobileDetect/MobileDetect.php");
 +
$mobile = mobiledetect();
 +
if ($mobile == false) $wgDefaultSkin = "vector"; # If not Mobile
 +
if ($mobile == true) $wgDefaultSkin = "chick"; # If is Mobile
 +
</pre>
 +
  
 
[[Category:Web_Site]]
 
[[Category:Web_Site]]

Latest revision as of 11:45, 24 February 2012

Move the installation directory

The MediaWiki does not record the installation path in the database. If the directory is moved or changed, just simply update the $wgScriptPath in the LocalSettings.php file.

$wgScriptPath       = "/wiki";

Hide tabs

Reference: http://www.mediawiki.org/wiki/User:Subfader/Hide_page_tabs
This is to hide a tab on all pages. Note that hiding tab does not prevent from accessing the page.

  • Update MediaWiki:Common.css.
/* Hide [Watch] tab */
#ca-watch { display: none !important; }

/* Hide [History] tab */
#ca-history { display: none !important; }

/* Hide [View Source] tab */
#ca-viewsource { display: none !important; }

/* Hide [Discussion] tab */
#ca-talk { display: none !important; }

Change Favicon

Reference: http://www.mediawiki.org/wiki/Manual:$wgFavicon
Use the free icon generator web site like http://www.favicon.cc/.

Use Google AdSense extension

Reference: http://www.mediawiki.org/wiki/Extension:Google_AdSense_2

Use Short URL

References:
http://www.mediawiki.org/wiki/Manual:Short_URL
http://www.mediawiki.org/wiki/Manual:Short_URL/wiki/Page_title_--_PHP_as_a_CGI_module,_no_root_access
Sample of the default page address is

http://website.com/wiki/index.php?title=Page_title

The Short URL version of above is

http://website.com/wiki/Page_title

Sample here is for 1and1 hosting using PHP as a CGI module with no root access.

  • Update the LocalSettings.php.
$wgScript           = "$wgScriptPath/index.php";
$wgRedirectScript   = "$wgScriptPath/redirect.php";
$wgArticlePath      = "$wgScriptPath/$1";
$wgUsePathInfo      = false;     
  • Update the .htaccess file in the web root where the MediaWiki is installed.
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wiki/index.php?title=$1 [L,QSA]

Note that AddType and AddHandler are added because by default 1and1 will handle the .php file with PHP4 - http://faq.1and1.com/archive/44.html

Add custom error-landing page

Reference: http://faq.1and1.com/scripting_languages_supported/configuring_apache_server_using_htaccess/2.html

Restrict anonymous editing

Reference: http://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_anonymous_editing

Restrict account creation

Reference: http://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_account_creation

Integrate Google Analytics

http://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration

Allow External Websites

This will allow ANY external image URLs.

$wgAllowExternalImages = true;

But the better approach is to limit the access using the white list.

$wgAllowExternalImages = false;
$wgEnableImageWhitelist = true;

http://www.mediawiki.org/wiki/Manual:$wgEnableImageWhitelist

Change the default skin

## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'vector', 'monobook':
$wgDefaultSkin = 'vector';
#$wgDefaultSkin = 'monobook';

Add embedded videos

http://www.mediawiki.org/wiki/Extension:EmbedVideo

Change font size of pre

Edit MediaWiki:Common.css with:

  pre { font-size: 100%; }

Mobile-device detection

http://www.mediawiki.org/wiki/Extension:MobileDetect

## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'vector', 'monobook':
require_once("$IP/extensions/MobileDetect/MobileDetect.php");
$mobile = mobiledetect();
if ($mobile == false) $wgDefaultSkin = "vector"; # If not Mobile
if ($mobile == true) $wgDefaultSkin = "chick"; # If is Mobile