MediaWiki/Customization

From Omnia
Revision as of 20:45, 26 October 2023 by Kenneth (talk | contribs) (→‎Hide [edit] links)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The default logo is:

/skins/common/images/wiki.png (135x135)

To change $wgLogo:

## The relative URL path to the logo.  Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
$wgLogo             = "$wgStylePath/common/images/wiki.png";

Allow Uploads

LocalSettings.php:

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads       = true;

NOTE: Only users who are logged in will be able to Upload files.

Hide [edit] links

How do I hide the section edit links for users who are not logged in? [1]

Edit your skin, eg MonoBook.php, and add this before </head>:

 <?php if(!$this->data['loggedin']) { ?>
     <style>
         <!--
         .editsection { display: none; }
         -->
     </style>
 <?php } ?>

If you want to hide the links for all users including logged in users, instead edit monobook/main.css and add .editsection { display: none; }

Enable Uploads for .zip Files

Modify LocalSettings.php and add:

// List of allowed uploadable file extentions
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'zip' );

Then you can upload the file and add a link via:

[[Media:Test.zip]]
or
[[Media:Test.zip|My File]]

Edit Sidebar

See:

/MediaWiki:Sidebar

Edit Sidebar menu items:

/MediaWiki:Sidebar?action=edit

old:

?title=MediaWiki:Sidebar&action=edit

Also accessible via:

  1. Click on Special pages in the toolbox menu.
  2. Click on All pages.
  3. Change the drop-down menu to "MediaWiki."

Manual:Interface/Sidebar - MediaWiki - https://www.mediawiki.org/wiki/Manual:Interface/Sidebar

Background Color

Edit MediaWiki:Common.css

Remove Tabs

Manual:Remove Tabs - MediaWiki - https://www.mediawiki.org/wiki/Manual:Remove_Tabs

Edit MediaWiki:Common.css

Code Explanation
#ca-nstab-main { display:none!important; } Page tab
#ca-nstab-user { display:none!important; } User page tab (the Page tab on personal user pages)
#ca-talk { display:none!important; } Discussion tab
#ca-view { display:none!important; } Read tab (from the prepackaged skins this tab is available only in the Vector skin)
#ca-edit { display:none!important; } Edit tab
#ca-history { display:none!important; } View history/History tab
#ca-watch { display:none!important; } the Watch tab for adding the page to the watchlist
#ca-unwatch { display:none!important; } the Unwatch tab for removing the page from the watchlist
#ca-delete { display:none!important; } Delete tab (in the Vector skins it's displayed with the More drop-down menu)
#ca-move { display:none!important; } Move tab (in the Vector skin it's part of the More drop-down menu)
#ca-protect { display:none!important; } Protect tab (as the previous two, with the Vector skin it's in the More drop-down menu)
#ca-viewsource { display:none!important; } View source tab; this tab is available for users who belong to user groups that don't have the permission to edit pages. With it the user can view the source text of the page without being able to modify it.

Edit Area Rows

This is a per user setting under the user's preferences:

  • My Preferences
  • Editing
  • Default: Rows 25 x Columns 80
    • Bump to Rows 35 for a larger screen

Search Suggestion

Manual:$wgEnableMWSuggest - MediaWiki - http://www.mediawiki.org/wiki/Manual:$wgEnableMWSuggest

"Enable AJAX autocomplete search suggestions (autosuggest) while typing in search boxes (results are passed around in OpenSearch format). This setting replaces $wgAjaxSearch that was used in earlier versions of MW."
$wgEnableMWSuggest = true;

Extension:Link Suggest - MediaWiki - http://www.mediawiki.org/wiki/Extension:Link_Suggest

"Adding links to an article seems easy. But what happens when you dont know the exact capitalization, or wording of an article? Usually you open a new tab and do a search. This plugin adds a new button to the edit tool bar that when clicked, adds an ajax search bar to find links. This plugin is in very beta, but I am putting it out here because I think it is usable, and it is as far as I can take it. I would love help on this to make it better."

Extension:Search Suggest - MediaWiki - http://www.mediawiki.org/wiki/Extension:Search_Suggest

"This extension is obsolete! It has been replaced by core functionality in the MediaWiki software (which was added in version 1.13.0). See Manual:$wgEnableMWSuggest for the new core feature."

Subpages

Wikibook uses subpages to organize pages into a hierarchy. Exmaple: /book/chapter/page

Help:Subpages - MediaWiki - http://www.mediawiki.org/wiki/Help:Subpages

Table of contents:


Manual:$wgNamespacesWithSubpages - MediaWiki - http://www.mediawiki.org/wiki/Manual:$wgNamespacesWithSubpages

LocalSettings.php:

# Enable subpages in the main namespace
$wgNamespacesWithSubpages[NS_MAIN] = true;

php - What Software Does Wikibooks Use? - Webmasters Stack Exchange - http://webmasters.stackexchange.com/questions/8360/what-software-does-wikibooks-use

Better subpage toc formatting:

subpagelist.png

Using Wikibooks/How To Structure A Wikibook - Wikibooks, open books for an open world - http://en.wikibooks.org/wiki/Using_Wikibooks/How_To_Structure_A_Wikibook

  • Guide to structuring a book
Book_Title/Chapter_Name
Book_Title/Chapter_Name/Page_Name

Nice looking navigation template:

  How to use a Motorola DVR
Identify | Connections | Setup | ...

Default Skin

Manual:$wgDefaultSkin - MediaWiki - http://www.mediawiki.org/wiki/Manual:$wgDefaultSkin

"This setting defines the default skin and should be set to the lowercase name of the skin (e.g. 'monobook', not 'MonoBook'). Note that this only sets the default skin, for new users and anonymous visitors."

Default Main Page

How do I change which page is the main page? - http://www.mediawiki.org/wiki/Manual:FAQ#How_do_I_change_which_page_is_the_main_page.3F

By default, MediaWiki looks for a page with the title Main Page and serves this as the default page. This can be changed by altering the contents of MediaWiki:Mainpage to point to a different title. If this does not change the 'Main Page' link included on the sidebar at install time, edit MediaWiki:Sidebar.

Revision Deleteion

# RevisionDelete - http://www.mediawiki.org/wiki/Manual:RevisionDelete
# Fails with: Cannot inherit previously-inherited or override constant READ_LATEST
$wgGroupPermissions['sysop']['deleterevision'] = true;
$wgGroupPermissions['sysop']['deletelogentry'] = true;
#$wgGroupPermissions['oversight']['hideuser'] = true;
#$wgGroupPermissions['oversight']['suppressrevision'] = true;
#$wgGroupPermissions['oversight']['suppressionlog'] = true;

Bug 65175 – RevisionDelete - Cannot inherit previously-inherited or override constant READ_LATEST from interface IDBAccessObject in Revision.php on line 26 - https://bugzilla.wikimedia.org/show_bug.cgi?id=65175

Delete All History

See https://www.mediawiki.org/wiki/Manual:DeleteOldRevisions.php

.../maintenance$ php  deleteOldRevisions.php --delete

Modify General CSS

CSS placed here will be applied to all skins

https://wiki.example.com/wiki/MediaWiki:Common.css

CSS placed here will affect users of the Vector skin

http://wiki.example.com/wiki/MediaWiki:Vector.css

Modify User's CSS

https://wiki.example.com/wiki/Special:MyPage/common.css

Hide Sidepanel

You can do so by adding something like the following to your wiki's MediaWiki:Vector.css / MediaWiki:Common.css page.

/** Hide sidebar **/
div#mw-panel {
  display: none;
}
#left-navigation {
  left: 1em;
}
#mw-head-base,
div#content,
div#footer {
  margin-left: 1em;
}

References:

Hide Footer

Add the following to MediaWiki:Common.css:

/** Hide Footer **/
#footer {
  display: none;
}

Other

  1. For more information on customizing the URLs please see:
  2. http://www.mediawiki.org/wiki/Manual:Short_URL



  • MediaWiki Tips and Tricks:
    • How to Automatically Create a Sitemap for Google Sitemaps (Webmaster Tools)
    • Adding Google Adsense to your MediaWiki Site
    • Adding Google Search Box to your MediaWiki Site
    • How to Hide MediaWiki's Image History from Non-logged in Visitors
    • How do i remove the funny arrow icon beside external links in MediaWiki


Linux Journal: Installing and Customizing MediaWiki

  • Installing MediaWiki
  • Virtual Servers
  • Basic Navigation and Editing
  • Special Pages