Manual:Configuração de temas
Esta página explica como administradores podem configurar os temas de uma wiki.
Esta documentação aplica-se ao MediaWiki 1.31+.
Para usar temas, consulte Help:Skins , onde são detalhadas maiores informações sobre temas.
Para desenvolvedores que desejam criar novos temas ou editar temas existentes, consulte Manual:How to make a MediaWiki skin para informações técnicas.
Baixando temas
O download do tarball do MediaWiki vem integrado com vários temas. Veja a lista em Extensões e temas inclusos#Temas.
Contudo, se você baixou MediaWiki a partir do Git, ou se você quer instalar temas adicionais, você vai precisar baixar o código para esses temas separadamente.
Vários temas do MediaWiki estão hospedados no repositório Git da Wikimedia (veja a listagem completa de temas no repositório). Você pode baixar os tarballs dos temas a partir do distribuidor de temas.
Para baixar um dos temas deste grupo via Git, você deve fazer uma chamada como a seguinte:
git clone https://gerrit.wikimedia.org/r/mediawiki/skins/[nome do tema]
P. ex.: Para baixar o tema padrão Vector, você deve executar o seguinte a partir do subdiretório skins/
da sua pasta de instalação do MediaWiki:
git clone https://gerrit.wikimedia.org/r/mediawiki/skins/Vector
Faça o checkout de uma release específica do tema. Mude para o novo diretório e execute:
git checkout REL1_35
(substitua REL1_35
por outra release, branch ou tag)
Habilitando temas
Para qualquer tema em seu diretório /skins
que você deseje usar, você deve ativá-lo no seu arquivo LocalSettings.php
.
Por exemplo, para permitir o Vector, adicione o seguinte.
Caso você tenha múltiplos temas, cada um deve estar ativo com uma declaração separada:
// MediaWiki 1.24 or less require_once "$IP/skins/Vector/Vector.php"; // MediaWiki 1.25+ wfLoadSkin( 'Vector' );
(Isso é equivalente a ativar uma extensão, com a diferença de ser em um diretório diferente.)
Etapas adicionais podem ser necessárias, dependendo da escolha do tema. Instruções mais detalhas de instalação estão disponíveis em cada página de tema no mediawiki.org; por exemplo, para o Vector, veja Tema:Vector#Instalação. O mesmo vale para a instalação de outros temas.
Definindo o tema padrão de uma wiki
A default skin should be set for new users of a wiki by setting the variable $wgDefaultSkin
in LocalSettings.php
to the lowercase skin name specified in the skin file. Users can still change their skin by going to their preferences page, unless you uninstall or suppress all other skins, or disable the preference altogether (see below). For example:
$wgDefaultSkin = 'vector';
Changing these values on an existing wiki will automatically change the setting of all users who have been using the previous default skin. There is a maintenance script to change users' preferences (userOptions.php ), but you will most likely not need to use it.
If you do not change this value, Vector will be the default skin.
Desinstalando temas
To uninstall a skin, remove the wfLoadSkin
(or require_once
for MediaWiki 1.24 or older) line from your LocalSettings.php
file.
You may remove the skin files from the skins/
directory afterwards.
If any users have been using the skin you just uninstalled, MediaWiki will automatically switch them to the default skin of the wiki.
Suppressing skins without uninstalling
The administrator can limit the skin choices that are offered site-wide in user's preferences by listing skin(s) to suppress in the $wgSkipSkins
array. This might be useful if you want to test a new skin without letting users see it. To do this, put something like this in LocalSettings.php
:
// To remove various skins from the User Preferences choices
$wgSkipSkins = array( "monobook", "timeless" );
You will be able to preview the skin using the useskin URL parameter.
Site-wide CSS modifications
MediaWiki allows administrators to specify site-wide CSS rules to be added to every page rendered.
These rules can be added by editing the page MediaWiki:Common.css on your wiki, if $wgUseSiteCss
is set to true.
In addition to a global stylesheet, one can also specify CSS rules to be used only in certain skins (see Manual:Interface/Stylesheets).
User CSS modifications
Users can also specify their own CSS rules by creating the page "User:Username/common.css".
The CSS on this page is then applied to whatever skin the user is using.
If the website is changed to a different default skin, the user's custom CSS will continue to work just as before.
This feature can be enabled by setting $wgAllowUserCss
to true in LocalSettings.php
.
A user can also apply CSS to a specific skin by creating the page "User:Username/skinname.css".
If a user uses the MonoBook skin for example, they would edit the page Special:MyPage/monobook.css.
Disable site users' ability to choose skins in user preferences
Versão MediaWiki: | ≥ 1.16 |
The system administrator can completely remove the "Skin" option so that it does not show up at all in User Preferences. This makes sense if your site will use a customized skin and would not look right in any other skin.
To do it, add a new line containing the following code to LocalSettings.php. It will remove the "Skin" option from preferences and the possibility to use the useskin
parameter in the URL.
$wgHiddenPrefs[] = 'skin';