Manual talk:$wgLogo

From mediawiki.org
Latest comment: 2 years ago by MarioSuperstar77 in topic Is it deprecated?

Here's what I've tried[edit]

In my effort to follow the various directions scattered around MediaWiki in order to see a logo on my wiki, here's what I've tried:

Following the advice on the "Manual" next door,: $wgLogo = $wgScriptPath . '/images/a/a8/PMlogo.png';

Following the advice below: $wgLogo = "http://savetheworld.saltshaker.us/images/a/a8/PMlogo.png";

I forget where I came up with this: $wgLogo = "$wgScriptPath/images/a/a8/PMlogo.png";

The automatically generated path was: "$wgResourceBasePath/resources/assets/PMlogo.png";

DefaultSettings.php said: $wgLogo = true;

I also messed with $wgResourceBasePath = $wgScriptPath;

I tried $wgResourceBasePath = "$wgResourceBasePath/resources/assets/PMlogo.png" and got Parse error: syntax error, unexpected '$wgLogo' (T_VARIABLE)

Defaultsettings.php said the default was $wgResourceBasePath/resources/assets/wiki.png (without an equals sign)

Somewhere I had begun with $wgResourceBasePath = $wgScriptPath;

So I tried $wgResourceBasePath = "/resources/assets/wiki.png" (Wouldn't load; syntax error in the logo line)

I also messed with $wgScriptPath = ""; that was the automatically generated setting.

A mediawiki article gave for its example $wgScriptPath = '/w'; which produced a syntax error keeping the wiki from loading. The article gave zero explanation of what it means or does or whether there is any alternative setting.

My version is 1.30.0. Skin, Cologne Blue.

I notice that some of these articles and discussions haven't been updated in a decade. I wonder if that makes any of these directions out of date?

Or have I just failed to correctly decode the directions?

I see that I am not supposed to post a "support question" here. I don't know what that means, since all the questions are about the difficulty people have implementing the directions when the directions don't work. — Preceding unsigned comment added by DaveLeach (talkcontribs)

The directions seem to be pretty simple and efficient to me. If it did not work in the first place, you should investigate what could go wrong... See the HTML code of a page or inspect it with the developer tools of the browser (F11 key), to see where your logo is pointing in the generated HTML, and how it differs from the URL of the uploaded logo. Please use support desk for this. --Ciencia Al Poder (talk) 10:01, 31 March 2018 (UTC)Reply

[edit]

The image would not display until I specifically clicked on the image. Initially the image showed up in the edit page only. Restarting apache and reloading the page is not sufficient.

I have just added this to the manual. --Jörgi123 (talk) 09:51, 29 May 2016 (UTC)Reply

Relative path didn't work // Another question on how to use $wgScriptPath[edit]

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) /KristoferPReply

I had to use $wgLogo = "/wiki/skins/common/images/logo.png"; Dejvid 14:48, 13 August 2007 (UTC)Reply
To the original poster: $wgLogo = "$wgScriptPath/skins/common/images/logo-snf.png"; should work for you.
To Dejvid: $wgLogo = "$wgScriptPath/skins/common/images/logo.png"; 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)Reply
To Dejvid: Using $wgScriptPath" solved my problem with .htaccess, also absolute paths did work but I prefer not to use URLs, thank you. Mr.TAMER.Shlash (talk) 07:04, 7 October 2012 (UTC)Reply


Tried the above method, using absolute URLs.[edit]

I already have the image on my website that I want to use. I get an error that reads: Parse error:

syntax error, unexpected '"' in /home3/legionxi/public_html/wiki/LocalSettings.php on line 40

Line 40 of the LocalSettings.php reads (Except, without the brackets, because MediaWiki won't let me put an actual link here.):

$wgLogo = "[https]://caelestis-templares.com/FavIcon.jpg"

Can't figure out for the life of me what's wrong. When I look up the image listed, it displays in a browser just fine. But, the syntax disagrees with me.

As was said in Star Wars: "Help me, ObiWan! You're our only hope!"
--IcarusATB (talk) 23:34, 3 December 2018 (UTC)Reply

You're missing the semicolon at the end of the line. --Ciencia Al Poder (talk) 10:06, 4 December 2018 (UTC)Reply
Thanks, Ciencia! I can't believe I missed that! I am also now able to use the default path, and have it in /resources/assets. Thanks for the grammar-lessson! Ha haha! --IcarusATB (talk) 18:27, 4 December 2018 (UTC)Reply

[edit]

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

The possible sizes are determined by the design of the according skin.Using a bigger logo is not currently supported. --Jörgi123 (talk) 10:00, 29 May 2016 (UTC)Reply

SELinux security context[edit]

I too had this issue where the image would not display using the correct syntax. In my case it was caused by using the improper SE Linux context for the file, which was assigned to it when I scp'd the file to the server. To correct change context with this command: chcon -t httpd_sys_content_t logo.png

9 May 2007[edit]

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)Reply

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)Reply

Where to edit LocalSettings.php[edit]

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)Reply


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)Reply

Why simply overwriting the default image is bad advice[edit]

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)Reply

Documentation is inaccurate[edit]

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)Reply

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)Reply
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|C) 19:59, 5 September 2008 (UTC)Reply

[edit]

The following code, added to your LocalSettings.php file, will randomize your site's logo. A different logo (random) will appear for each page:

$logoNames[] = "Logo01.png";
$logoNames[] = "Logo02.png";
$logoNames[] = "Logo03.png";
$logoNames[] = "Logo04.png";
$logoNames[] = "Logo05.png";

$wgLogo             = "/myWiki/skins/common/images/" . $logoNames[array_rand($logoNames)];

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)Reply

As there is no skins/common/ folder in current versions anymore, the paths for the files have to be changed, but the basic idea should still be working. Note however that nowadays, the CSS code, which contains the path to the logo, gets included using load.php. The according content gets cached inside a MediaWiki cache. After that, it will no longer be really random as it would be, if $logoNames[array_rand($logoNames)] would really be executed on every single page hit. Instead, you will each time see the cached version - until the according cache expired. --Jörgi123 (talk) 09:55, 29 May 2016 (UTC)Reply

[edit]

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

$wgLogo = "c:\users\admin\desktop\logo.jpg"

Use
$wgLogo = "";
instead. --80.129.238.219 01:56, 13 August 2010 (UTC)Reply

how to make this work 100% of the time.[edit]

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)Reply

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)Reply
i agree, but many won't run it that way, especially on ubuntu where sudo apt-get install mediawiki does it all and is automatically upgraded. Zeefreak 18:00, 28 May 2010 (UTC)Reply
...and one version broken by packagers gets updated to another version broken by packagers, great. Max Semenik 18:14, 28 May 2010 (UTC)Reply
Heh.--Diego Grez return fire 18:15, 28 May 2010 (UTC)Reply

Why $wgLogo and not CSS?[edit]

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 $wgScriptPath/skins/Monobook.php. Search for "background-image" (only one occurrence) and remove:

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

now the Logo can be set in MediaWiki:Monobook.css, e.g.

#p-logo a {
  background-image: url("http://younameit");
}

.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)Reply
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[edit]

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)Reply
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)Reply

Logo compressed, now blurry[edit]

It seems there is a compression of some sort with my logo. It doesn't appear as sharp as when opened on my computer. 93.89.134.1 21:32, 22 September 2011 (UTC)Reply

By default the original image should be used. It may however be scaled, if this image does not fit the necessary size. --87.123.31.8 00:35, 31 December 2015 (UTC)Reply
Actually, on the side of MediaWiki scaling will not happen. Instead, only part of the image will be shown. The manual page says that correctly. Compression may happen depending on other factors, e.g. when the page is accessed with a mobile device using a mobile connection, e.g. LTE or so. However, these factors are not MediaWiki related. --87.123.56.23 09:28, 21 October 2016 (UTC)Reply

$wgConf[edit]

Is this configurable with $wgConf? If so, how?Jasper Deng (talk) 07:01, 26 February 2012 (UTC)Reply

1.19.1 $wgLogo variable not working[edit]

I had and issue with the logo not showing up for relative path, full url, and using $wgLogo = "";

I had to disable the php apc caching module and now everything works fine. It is probably just a apc config issue, but i am not going to use apc in the mean time for my small deployment.

API[edit]

The logo location is accessible via API somehow, isn't it? How do you do that? Leucosticte (talk) 10:43, 27 December 2013 (UTC)Reply

The $wgLogo seems doesn't wok after I import zh-wiki's dump![edit]

After I import dump from zhwiki-20150602-pages-articles.xml.bz2. The logo changed. I think I just import pages from dump. Why the logo changed? And what ever I set in $wgLogo, even "". The logo unchanged at all.Anyone can help me? Thanks.

The Special:Setting page show the $wgLogo right. But on normal page, $wgLogo doesn't work at all.

I really not know why!

logo location is /skins/common/images/wiki.png[edit]

Not the:

/resources/assets/wiki.png

...as listed. Headtransplant (talk) 09:57, 4 January 2016 (UTC)Reply

The default location has changed. In older versions, there was such a common/ folder inside the skins folder, but I think this common/ folder has been removed some versions ago already (MW 1.24 or so maybe). In newer versions, the default location really is {$wgScriptPath}/resources/assets/wiki.png. See the according change in the MediaWiki source code. --87.123.57.36 16:36, 16 March 2016 (UTC)Reply

[edit]

Can i use SVG-graphics in $wgLogo? --81.23.161.100 16:16, 9 January 2017 (UTC)Reply

    Yes, you just need to upload the SVG image and change $wgLogo variable. --User:LCavalini 00:42, 11 September 2019 (UTC)Reply

I want to edit this page[edit]

Do I have to be autoconfirmed? Infinitepeace (talk) 09:36, 9 January 2018 (UTC)Reply

Yes. You can also post here what do you want to change. --Ciencia Al Poder (talk) 21:14, 9 January 2018 (UTC)Reply

Permissions may need to be changed[edit]

Following those instructions alone doesn't get the logo to appear on my system. I have found it necessary to ease the permissions on the directories containing the logo: chmod 770 resources, chmod 770 assets, and chmod 770 logo.png. I don't love that but the logo doesn't appear otherwise. If I try chmod 555, MediaWiki crashes with a long stack trace. -- Econterms (talk) 01:38, 15 January 2021 (UTC)Reply

I did as you said earlier this month, but that does not work. I believe you had a very specific issue with your server. MarioSuperstar77 (talk) 21:48, 27 May 2021 (UTC)Reply

Is it deprecated?[edit]

The software tells me to change $wgLogos instead of $wgLogo, and $wgLogo won't work on my Mediawiki installation no matter what is done. If it is indeed deprecated, it should probably be noted on the article that is the case. MarioSuperstar77 (talk) 13:22, 26 May 2021 (UTC)Reply

Which skin are you testing?
From Manual:$wgLogos: Current support for this key is limited to Skin:Vector, Skin:Timeless but this is recommended for all new skins --Ciencia Al Poder (talk) 11:45, 27 May 2021 (UTC)Reply
I am using the default one, the same one as this site's or Wikipedia, I think it is called Vector and $wgLogo does not work in spite of that. So, I was wondering whether it was deprecated, but someone forgot to mention it, or if I had done something wrong with my mw installation. MarioSuperstar77 (talk) 21:46, 27 May 2021 (UTC)Reply
From my understanding, $wgLogos is the current recommendation, but if you don't set it and only set $wgLogo, MediaWiki will fill $wgLogos with it and it should work for skins that don't use special logos like wordmarks or similar. Vector works for me, so my guess is that your logo can't be fetched by the browser. Try setting a full URL for that. --Ciencia Al Poder (talk) 09:39, 28 May 2021 (UTC)Reply
F12 should catch anything that can't normally be fetched and I do know that since I have mixed content issues on the site with Cloudflare, the browser would warn me when css or javascript is not loaded over one part of my site, this issue does not even affect Mediawiki since everything loads correctly, from the favicon to articles' file path images are loaded correctly. Additionally, Mediawiki manages to fetch the default logo from /resources/assets/wiki.png, if that was an issue with my browser or even the server, no logo should display period it should either give me a red link or its associated alt text. I tried the full url thing way before I posted here as well as with wgScriptPath and with wgServer, I was not kidding when I said that nothing would work.
Did you install a fresh Mediawiki 1.35.2 like I did or did you have a previous installation of Mediawiki that did fully support wgLogo, like let's say 1.20.1? MarioSuperstar77 (talk) 21:30, 29 May 2021 (UTC)Reply