Manual talk:$wgLogo

Adding Logo to version 1.10.2
I did not want my logo to come from a url so I got it locally. I created a 135 x 135 pixel png file. Then I uploaded that file through my MediaWiki site. After that I searched under my /images folder to find out where it went. In my case it went to /images/4/47/mylogo.png. When I tried $wgLogo = "/images/4/47/EDS_Logo.png"; nothing worked. What worked for me was '''$wgLogo = $wgScriptPath. "/images/4/47/mylogo.png";'''

this also worked for me, thanks.

Things are complicated because...
What we're dealing with here isn't just html or creating a webpage. I've been a web author and webmaster for various isp's for quite a few years and I'm just now really getting into programming beyond simple things for the web, and this level of complexity comes about because of the huge amount of issues that go into programming something of this size.

It took me awhile to figure out the $wgLogo thing as well, but the suggestion below of: $wgLogo = "$wgScriptPath/images/logo.png"; worked fine, and to answer the question as to why this works, it works because $wgScriptPath is a variable that points to the main directory of your wikipedia directory.

Relative path didnt work
Can't get relative path to work. Absolute path works fine though.

$wgLogo = "http://i-okul.net/i-okul_simge.png"; Works fine

$wgLogo = "skins/common/images/logo-snf.png";

Does not work at all

--81.170.158.69 14:03, 1 June 2007 (UTC) /KristoferP
 * I had to use $wgLogo = "/wiki/skins/common/images/logo.png"; Dejvid 14:48, 13 August 2007 (UTC)


 * To the original poster:  should work for you.
 * To Dejvid:  should allow you to use a relative path, rather than the full web-server path (useful if your wiki ever moves). --HappyDog 10:38, 16 January 2008 (UTC)

Noob needs help
Hello, where do I change the logo? Should i go to an article called "MediaWiki: $wgLogo"? 213.64.166.47 18:07, 22 July 2006 (UTC)
 * No, you must change the variable $wgLogo. For this, go in the file LocalSettings.php and write at the end :

$wgLogo = "index.gif";
 * where /image.png is the name of your file. The default value is the file /skins/common/images/Wiki.png. ~ Seb35 13:27, 23 July 2006 (UTC)
 * And where's that file? (I'm still a noob)
 * If your wiki is up and running, it should be in the same directory as index.php (perhaps document root, perhaps /wiki, etc.). —dto 07:51, 8 September 2006 (UTC)


 * What are the proper dimensions for this file? -Derick Eisenhardt 2006-01-08@00:01CST
 * Added to article. --HappyDog 12:15, 8 January 2007 (UTC)


 * The logo should be no larger than 135p X 135p. It can be smaller.

Immediately after a successful install of Version 1.9, I had trouble replacing the default MediaWiki logo. I edited the LocalSettings.php file as directed. Since MediaWiki Version 1.9 LocalSettings.php does not contain a $wglogo variable, I added one. But it did not work. I tried using a relative path, then I tried using an absolute path. Neither worked. This was frustrating. Finally, I included the $wgScriptPath in the path statement and it worked. It looked like this:

$wgLogo = "$wgScriptPath/images/logo.png";

(My custom logo was placed in a directory named images, which was in the directory where I installed MediaWiki, like this: www.example.com/directory1/wiki/images.) In the LocalSettings.php file, $wgScriptPath was already defined as /directory1/wiki.

I don't know enough about php to know why this worked instead of an absolute or relative path. Maybe it was just the way my host server was set up, or maybe it's the way variables work. Anyway, if you're having this trouble, try it. --Jable 20:48, 4 February 2007 (UTC)

I had also great difficulties solving the logo problem. I am generally surprised that things are so complicated. I mean we have the year 2007 and i am sure there would be ways to make things easier. Why that's not the case is a riddle to me.

Anyway this is how it was solved. I did what was suggested at the very beginning, although i was scared to add or do anything in the LocalSettings.php file. I just added this as the last line, but make sure it's before that  ?>   (which is the end of the code, in case you don't know anything about programming)

$wgLogo = "index.gif";

however instead of index.gif, you use the name of your file. mynewlogo.gif (for example)

make sure your actual gif (mynewlogo.gif) is uploaded. This should work fine then. I was surprised when it did.

3 March 2007 I have been creating webpages for a few years now using html code and am surprised how difficult I'm finding this. I have struggled even to change the logo, like some of you have and I'm glad I found this page. I tried to follow the tutorial from Siteground.com, but ended up just deleting the default logo. The answer to my problem was to add the line: $wgLogo = "images/logo.jpg"; to the end of the LocalSettings.php file (before the ?>) and then place the logo file itself in the mediawiki-1.9.3/images folder. (I discovered where to place this by using my ws-ftp software and placing the file in different folders until I found one that worked! Ken.

March 23, 2007 Another Noob needs detail on "modifying the site CSS" I would like to use a larger logo.

May 8, 2007 This may be beyond basic but it screwed me up for several days, ensure that whatever editor you edit your localsettings.php file with does not automatically add html headers to your file. It will cause major errors and leave you wondering how the small changes you made to one line of code could screw things up so badly.


 * Can the logo be SVG?

9 May 2007
I struggled with this until I realized you can't use the variables $wgUnloadPath or $wgUploadDirectory in the script. I set the $wgLogo variable to the absolute path instead and it worked fine:

$wgLogo = "/wiki/images/Wiki_logo.gif";

--Tamouse 23:49, 9 May 2007 (UTC)


 * Thanks. Phew! (this php thing is pure evil) I gave up short URLs already lol, but I needed a logo lol. 354d 09:44, 15 August 2007 (UTC)

21 Sept 2007
Wow, that wasn't annoying...this was already mentioned but i would just like to say it again - make sure that whatever editor you're using doesn't add any html headers automatically - if you're not sure you can try the fix on emacs or, for the more novice, windows notepad. This fix made me not want to kill the next person that asked, "hey, how's the site coming?"

Wierd Logo Problem
Hi guys, I tried to edit the LocalSettings.php to do what was said above. I did that but the logo only displays when I'm in Edit Mode. When I'm just viewing the Wiki the logo does not display. Can anyone help? I'm using FCK Editor to replace the default wiki editor. Might that have something to do with it?

-I'm having the same problem. Would love to know what's going on.


 * I had the same problem when using: $wgLogo = "images/logo.png"; a change to $wgLogo = "{$wgScriptPath}/images/logo.png"; solved the problem. --BlackyTiger 20:45, 30 October 2008 (UTC)

Where to edit LocalSettings.php
For a logo at C:\wamp\www\mywikipedia\skins\common\images\mywikilogo.png put an entry like this at the bottom LocalSettings.php $wgLogo = "$wgScriptPath/skins/common/images/mywikilogo.png";

This has to be after the line where $wgScriptPath is defined.

Using $wgStylePath no longer works in 1.11, I understand, because of a change in DefaultSettings.php. Svanslyck 18:59, 27 October 2007 (UTC)

That Worked!! Thank you so much for you help! It was starting to drive me bananas! 70.71.250.152 22:18, 30 October 2007 (UTC)

in version 1.11
It took me ages to get the logo working but now have success. In this version the directory includes /skins/ directory which is absent in the syntax listed in this page

The path should be: mediawiki/skins/common/images

Just rename the current image wiki.png to wikiOLD.png (in case you need to replace

Then upload to this same directory a new image 135px x 135px and rename to wiki.png

It will then work

- oh if you find the logo does not appear (and no logo is appearing) check you local settings file has the $wgLogo variable commentted out with a hash


 * This is very bad advice! Never use this method of changing the logo. Instead you should upload your image to your server and set $wgLogo to point to that location, as described in the manual page.  This applies to all versions of MediaWiki from the very beginning up to the latest development branch.  --HappyDog 10:35, 16 January 2008 (UTC)

Documentation is inaccurate
What the documentation says to do does not work. The correct way to write in the $wgLogo variable is:

$wgLogo = "$wgScriptPath/skins/common/images/wiki.png";

Where wiki.png can be changed to the name of your png logo image. Make sure you put your image in that folder the path points to! Hope this solves your frustrations.--98.207.22.59 00:57, 28 May 2008 (UTC)
 * Maybe it depends on what version your mediawiki using at, which in my case, version 1.12.0., it doesn't work at all. the only thing that worked here is replacing mediawiki logo with yours. Agree, the instruction is useless--125.163.0.97 10:47, 5 September 2008 (UTC)


 * Not sure what you're talking about: All the article says you should do is not leave the path at its default. (The default value listed was incorrect, however.) —Emufarmers(T 19:59, 5 September 2008 (UTC)

Random Logo
The following code, added to your LocalSettings.php file, will randomize your site's logo. A different logo (random) will appear for each page: Simply create your logos, put them in the proper directory (/skins/common/images in the above example), and modify the LocalSettings.php file.

I don't think this should add too much overhead to page loads. -Cedarrapidsboy 16:05, 5 September 2008 (UTC)

Replacing wiki.png with your own
I've seen a few newbies think it's okay to replace /commons/images/wiki.png or whatever it is (the default one) with their own and leave the variable at default.

DON'T DO THIS. Next time you upgrade it will delete your image. Follow the correct directions on either this page or the man page. Cheers :) Deon555 02:45, 10 March 2009 (UTC)

Remove Logo
How do I remove the logo on my wiki. Sachein 12:52, 23 March 2009 (UTC)

$wgLogo = "c:\temp\logo_icgel.jpg"


 * Use instead. --80.129.238.219 01:56, 13 August 2010 (UTC)

This is broken
Please see here for a work-around. 122.26.138.182 03:09, 17 October 2009 (UTC)

Correct Directory
Working in version 1.14, I ran into the same problems. Although in my case I was editing the wrong version of LocalSettings.php Make sure to add all $wg commands to the LocalSettings.php in the root directory NOT the config directory.

THANK YOU - All my struggles were because I was editing the wrong but exact LocalSettings.php file. It didn't occur to me that there would be two files, of course I didn't do the initial install so that may be why I didn't know. This entire page needs to be rewritten! It's a mess! 11/20/2010 RSO

how to make this work 100% of the time.
i run a number of mediawiki instances on bsd, ubuntu, and oel. each is slightly different in its implementation, especially ubuntu who breaks the installation up and symlinks the different parts together. the problem is that the $wgScriptPath and $wgStylePath go to different locations depending on the system you are on, and how mediawiki was installed. basically, they are unreliable.

the key is to set $wgLogo to the relative path from your domain's DocumentRoot. [this is an apache directive, not mediawiki]

the following assumes your logo is $WIKINAME/skins/common/images/$LOGONAME.png

if your wiki url is domain.com/$WIKINAME/, your config should look like this: $wgLogo = "/$WIKINAME/skins/common/images/$LOGONAME.png";

if your wiki url is domain.com/foo/blah/yakkity/$WIKINAME/, your config should look like this: $wgLogo = "/foo/blah/yakkity/$WIKINAME/skins/common/images/$LOGONAME.png";

Zeefreak 15:40, 28 May 2010 (UTC)
 * Even better would be to get mediawiki from the Download page, and avoid the broken distro-specific packages :P. Bawolff 17:01, 28 May 2010 (UTC)


 * i agree, but many won't run it that way, especially on ubuntu where  does it all and is automatically upgraded. Zeefreak 18:00, 28 May 2010 (UTC)
 * ...and one version broken by packagers gets updated to another version broken by packagers, great. Max Semenik 18:14, 28 May 2010 (UTC)
 * Heh.--Diego Grez return fire 18:15, 28 May 2010 (UTC)

Why $wgLogo and not CSS?
I tried to display a different logo for different namespaces. The solution I came up with:

To allow a different Logo for different namespaces, modify . Search for "background-image" (only one occurrence) and remove:

style="background-image: url(text('logopath') ?>);"

now the Logo can be set in MediaWiki:Monobook.css, e.g. background-image: url("http://younameit"); }
 * 1) p-logo a {

.ns-100 #p-logo a { background-image: url("http://younameitdifferently"); }

Why is the logo set via localSetting.php instead of css? No hubris, I'm asking because I think there is a catch to my hack.
 * Note, your hack will still work without editing Monobook.php if you add !important to your style rules. I would assume the logo is done with a variable since Mediawiki is supposed to be configured generally using LocalSettings.php, not the css files. Also some skins may use a different method of outputting the logo that is incompatible with what you're doing. Bawolff 11:26, 15 August 2010 (UTC)
 * Thank you. I did not read the CSS specs right. Now I know highest specificity by style attribute can be overridden by !important. Franky, 22:48 15 Aug 10 UTC

Place the new logo in the correct Directory
My LocalSettings.php is at /etc/mediawiki and the $ScriptPath points to /usr/share/mediawiki. First, I placed the logo file into /etc/mediawiki and specified the absolute path in the $wgLogo parameter in LocalSettings.php - but the logo was not loaded. Only copying the file to the /usr/share/mediawiki/images and changing the path to the new destination helped. Can't mediawiki read the /etc/mediawiki folder?
 * It has to be a web-accessible path. Reach Out to the Truth 21:31, 25 January 2011 (UTC)
 * By that I mean you need to enter the image's web-accessible URL, not its path in the file system. Reach Out to the Truth 21:55, 25 January 2011 (UTC)

Display different logos for corresponding pages
How could it be possible to display different logo for corresponding pages ?

For example, something to do in the LocalSettings.php file like:

If http://www.mediawiki.org/wiki/page1 acceded $logoNames[] = "Logo01.png"; $wgLogo            = "/myWiki/skins/common/images/". $logoNames[$logoNames]; else $logoNames[] = "Logo02.png"; $wgLogo            = "/myWiki/skins/common/images/". $logoNames[$logoNames];

Thank you for your help