Cose di MediaWiki: differenze tra le versioni

Da I Segreti dell'Octt.

 
(4 versioni intermedie di uno stesso utente non sono mostrate)
Riga 11: Riga 11:
* [[MediaWiki:Common.css]] - Stili generali (<code>/* Gli stili CSS inseriti qui si applicano a tutti i temi */</code>)
* [[MediaWiki:Common.css]] - Stili generali (<code>/* Gli stili CSS inseriti qui si applicano a tutti i temi */</code>)
* [[MediaWiki:Print.css]] - Stili specifici alla stampa (<code>/* Gli stili CSS inseriti qui si applicano all'output in stampa */</code>)
* [[MediaWiki:Print.css]] - Stili specifici alla stampa (<code>/* Gli stili CSS inseriti qui si applicano all'output in stampa */</code>)
== Modificare la configurazione di estensioni e skin ==
In MediaWiki, le diverse estensioni e skin possono fornire alcune opzioni di configurazione, definite nella sezione <code>config</code> del file <code>extension.json</code> o <code>skin.json</code>, che possono essere sovrascritte esternamente dagli amministratori, senza modificare i file originali del componente.<ref>https://www.mediawiki.org/wiki/Manual:Extension.json/Schema#config</ref>
Per fare questo, basta aggiungere una variabile del tipo <code>$<Prefisso><NomeOpzione></code> al file <code>LocalSettings.php</code>; dove il prefisso è <code>wg</code> di default, eccetto se sovrascritto attraverso una chiave chiamata <code>_prefix</code>. Per esempio, se l'opzione si chiama <code>CosoText</code>, basta aggiungere una riga <code>$wgCosoText = "...";</code>.
{| class="wikitable mw-collapsible mw-collapsed"
|+Spiegazione IA
|In MediaWiki, how do I change a config value for a them? Must I change it in the skin.json or is there a proper way?
|-
|<mark>You should '''not''' change configuration values directly in</mark> <code>skin.json</code>. Doing so makes it difficult to update the skin later, as your changes will be overwritten when you download a new version. [1, 2]
The proper way to change a config value for a theme (skin) is to override it in your '''<code>LocalSettings.php</code>''' file. [3, 4, 5]
=== How to Override Skin Settings ===
Most modern MediaWiki skins define their configurable options in their <code>skin.json</code> file under a "config" section. To override these: [6]
# '''Identify the Variable Name:''' Look in the skin's <code>skin.json</code> file for the configuration keys. They usually look like <code>SkinNameVariable</code>.
# '''Add to LocalSettings.php:''' Open your <code>LocalSettings.php</code> file and add the variable with your desired value '''after''' the line where you load the skin (e.g., after <code>wfLoadSkin( 'SkinName' );</code>). [7, 8]
'''Example:'''
If you are using the '''Citizen''' skin and want to change its default theme, you would add this to <code>LocalSettings.php</code>:
<code>wfLoadSkin( 'Citizen' );
$wgCitizenTheme = 'dark'; ''// Example override''</code>
=== Other Proper Customization Methods ===
If you want to change the ''look'' rather than just a functional setting:
* '''Site-wide CSS:''' Use the page <code>MediaWiki:Common.css</code> on your wiki for changes that apply to all skins.
* '''Skin-specific CSS:''' Use <code>MediaWiki:SkinName.css</code> (e.g., <code>MediaWiki:Vector.css</code>) to target only a specific theme.
* '''User Preferences:''' Some settings (like the default skin itself via <code>$wgDefaultSkin</code>) can be set in <code>LocalSettings.php</code> but may still be overridden by individual users in their '''Special:Preferences'''. [1, 2, 9, 10]
Are you trying to change a specific setting for a particular skin, like '''Vector''' or '''Citizen'''?
[1] <nowiki>https://stackoverflow.com</nowiki>
[2] <nowiki>https://stackoverflow.com</nowiki>
[3] <nowiki>https://www.mediawiki.org</nowiki>
[4] <nowiki>https://www.mediawiki.org</nowiki>
[5] <nowiki>https://www.digitalocean.com</nowiki>
[6] <nowiki>https://www.mediawiki.org</nowiki>
[7] <nowiki>https://www.awardspace.com</nowiki>
[8] <nowiki>https://doc.wikimedia.org</nowiki>
[9] <nowiki>https://www.mediawiki.org</nowiki>
[10] <nowiki>https://workingwithmediawiki.com</nowiki>
|-
|So how do I change MedikColor for medik theme?
|-
|To change the <code>MedikColor</code> for the '''Medik''' theme, you must add the configuration variable to your '''<code>LocalSettings.php</code>''' file.
The variable you need is <code>$wgMedikColor</code>.
=== How to Apply the Change ===
# Open your <code>LocalSettings.php</code> file (typically found in the root directory of your MediaWiki installation).
# Locate the line where the Medik skin is loaded: <code>wfLoadSkin( 'Medik' );</code>.
# Add the following line '''below''' the loading line:
$wgMedikColor = '#YOUR_HEX_CODE';
* ''Replace <code>#YOUR_HEX_CODE</code> with your preferred color (e.g., <code>#00ff00</code> for green or <code>#ff0000</code> for red).''
=== Why this works ===
This setting controls the color of the '''navbar''' and '''underlines''' throughout the skin. By defining it in <code>LocalSettings.php</code> instead of <code>skin.json</code>, you ensure your customization is "update-proof" and won't be deleted if you upgrade the Medik skin later.
=== Advanced: Changing other Medik settings ===
If you want to customize further, Medik also supports changing the logo placement via <code>$wgWriteShowLogo</code> (options: <code>'main'</code>, <code>'sidebar'</code>, or <code>'none'</code>).
Are you looking to change any other specific parts of the layout, like the '''sidebar''' or '''logo''' position?
|}
== Rimuovere index.php dagli URL delle pagine ==
A quanto pare, con la configurazione predefinita [quando non si usa una sottodirectory?], MediaWiki fa sì che i link alla visualizzazione delle pagine siano sempre nel formato <code>/index.php?title=<NomePagina></code>, che è bruttissimo e rischia di non far indicizzare bene il sito sui motori di ricerca, anziché il più semplice formato <code>/<NomePagina></code>.
Per sistemare, premesso che il web server sia configurato correttamente per accettare richieste con l'URL semplificato, basta aggiungere questa riga extra al file <code>LocalSettings.php</code>:<ref>Manual:Short URL: URL like example.com/Page_title: https://www.mediawiki.org/wiki/Manual:Short_URL#URL_like_-_example.com/Page_title</ref> <code>$wgArticlePath = "/$1";</code>.


== Note ==
== Note ==


<references />
<references />

Versione attuale delle 16:07, 22 apr 2026

Appunti relativi all'uso e all'amministrazione di MediaWiki, e come fare alcune cose specifiche.

Strumento di citazioni nel VisualEditor

Di default, il VisualEditor non sembra avere un metodo per aggiungere citazioni e riferimenti nella pagina...

Se questo è il caso, è perché va attivata l'estensione (inclusa) Cite; questo aggiungerà un relativo tasto nel VisualEditor che comodamente permette di aggiungere le citazioni belline col classico numeretto cliccabile inline.[1]

Aggiungere CSS custom

MediaWiki include una funzionalità per permettere agli amministratori di aggiungere comodamente CSS custom al sito.[2][3] Basta modificare le pagine di sistema relative al tipo fogli di stile che si vogliono arricchire, vuote di default, aggiungendo il proprio codice:

  • MediaWiki:Common.css - Stili generali (/* Gli stili CSS inseriti qui si applicano a tutti i temi */)
  • MediaWiki:Print.css - Stili specifici alla stampa (/* Gli stili CSS inseriti qui si applicano all'output in stampa */)

Modificare la configurazione di estensioni e skin

In MediaWiki, le diverse estensioni e skin possono fornire alcune opzioni di configurazione, definite nella sezione config del file extension.json o skin.json, che possono essere sovrascritte esternamente dagli amministratori, senza modificare i file originali del componente.[4]

Per fare questo, basta aggiungere una variabile del tipo $<Prefisso><NomeOpzione> al file LocalSettings.php; dove il prefisso è wg di default, eccetto se sovrascritto attraverso una chiave chiamata _prefix. Per esempio, se l'opzione si chiama CosoText, basta aggiungere una riga $wgCosoText = "...";.

Spiegazione IA
In MediaWiki, how do I change a config value for a them? Must I change it in the skin.json or is there a proper way?
You should not change configuration values directly in skin.json. Doing so makes it difficult to update the skin later, as your changes will be overwritten when you download a new version. [1, 2]

The proper way to change a config value for a theme (skin) is to override it in your LocalSettings.php file. [3, 4, 5]

How to Override Skin Settings

Most modern MediaWiki skins define their configurable options in their skin.json file under a "config" section. To override these: [6]

  1. Identify the Variable Name: Look in the skin's skin.json file for the configuration keys. They usually look like SkinNameVariable.
  2. Add to LocalSettings.php: Open your LocalSettings.php file and add the variable with your desired value after the line where you load the skin (e.g., after wfLoadSkin( 'SkinName' );). [7, 8]

Example:

If you are using the Citizen skin and want to change its default theme, you would add this to LocalSettings.php:

wfLoadSkin( 'Citizen' );
$wgCitizenTheme = 'dark'; // Example override

Other Proper Customization Methods

If you want to change the look rather than just a functional setting:

  • Site-wide CSS: Use the page MediaWiki:Common.css on your wiki for changes that apply to all skins.
  • Skin-specific CSS: Use MediaWiki:SkinName.css (e.g., MediaWiki:Vector.css) to target only a specific theme.
  • User Preferences: Some settings (like the default skin itself via $wgDefaultSkin) can be set in LocalSettings.php but may still be overridden by individual users in their Special:Preferences. [1, 2, 9, 10]

Are you trying to change a specific setting for a particular skin, like Vector or Citizen?

[1] https://stackoverflow.com

[2] https://stackoverflow.com

[3] https://www.mediawiki.org

[4] https://www.mediawiki.org

[5] https://www.digitalocean.com

[6] https://www.mediawiki.org

[7] https://www.awardspace.com

[8] https://doc.wikimedia.org

[9] https://www.mediawiki.org

[10] https://workingwithmediawiki.com

So how do I change MedikColor for medik theme?
To change the MedikColor for the Medik theme, you must add the configuration variable to your LocalSettings.php file.

The variable you need is $wgMedikColor.

How to Apply the Change

  1. Open your LocalSettings.php file (typically found in the root directory of your MediaWiki installation).
  2. Locate the line where the Medik skin is loaded: wfLoadSkin( 'Medik' );.
  3. Add the following line below the loading line:
$wgMedikColor = '#YOUR_HEX_CODE';
  • Replace #YOUR_HEX_CODE with your preferred color (e.g., #00ff00 for green or #ff0000 for red).

Why this works

This setting controls the color of the navbar and underlines throughout the skin. By defining it in LocalSettings.php instead of skin.json, you ensure your customization is "update-proof" and won't be deleted if you upgrade the Medik skin later.

Advanced: Changing other Medik settings

If you want to customize further, Medik also supports changing the logo placement via $wgWriteShowLogo (options: 'main', 'sidebar', or 'none').

Are you looking to change any other specific parts of the layout, like the sidebar or logo position?

Rimuovere index.php dagli URL delle pagine

A quanto pare, con la configurazione predefinita [quando non si usa una sottodirectory?], MediaWiki fa sì che i link alla visualizzazione delle pagine siano sempre nel formato /index.php?title=<NomePagina>, che è bruttissimo e rischia di non far indicizzare bene il sito sui motori di ricerca, anziché il più semplice formato /<NomePagina>.

Per sistemare, premesso che il web server sia configurato correttamente per accettare richieste con l'URL semplificato, basta aggiungere questa riga extra al file LocalSettings.php:[5] $wgArticlePath = "/$1";.

Note