« New Flashlight Wiki | Main | Sortable Wiki Tables »

Wednesday December 1, 2010

Wiki Customization

The Flashlight Wiki that I set up recently is doing pretty well so far (though it isn't showing up in my webserver statistics so I don't know how many visitors I'm getting; well, it shows a total on the wiki page). But I have made a lot of changes to the default installation in order to get things the way I want them. So I though I would make a record of that in case I have to reinstall from scratch.


Things done in LocalSettings.php file:

Change path to new 135x135 logo that I made (from FAQ):


$wgLogo = "http://igirder.com/led.png";

Put in new line for favicon path (from FAQ):

$wgFavicon = "http://flashlight-wiki.com/backup/favicon.ico";

Restrict edits to registered users who have been confirmed by the admin (from FAQ):
// Prevent anonymous users from editing
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createpage'] = false;
$wgGroupPermissions['*']['createtalk'] = false;

// Prevent registered, non-confirmed users from editing (from FAQ):
$wgGroupPermissions['user' ]['move'] = false;
$wgGroupPermissions['user' ]['edit'] = false;
$wgGroupPermissions['user' ]['createpage'] = false;
$wgGroupPermissions['user' ]['createtalk'] = false;
$wgGroupPermissions['user' ]['upload'] = false;
$wgGroupPermissions['user' ]['reupload'] = false;
$wgGroupPermissions['user' ]['reupload-shared'] = false;
$wgGroupPermissions['user' ]['minoredit'] = false;
$wgGroupPermissions['user' ]['delete'] = false;

// Allow confirmed users to edit
$wgGroupPermissions['confirmed' ]['move'] = true; // Only add this line if you want all users to be able to move
$wgGroupPermissions['confirmed' ]['edit'] = true;
$wgGroupPermissions['confirmed' ]['createpage'] = true;
$wgGroupPermissions['confirmed' ]['createtalk'] = true;
$wgGroupPermissions['confirmed' ]['upload'] = true;
$wgGroupPermissions['confirmed' ]['reupload'] = true;
$wgGroupPermissions['confirmed' ]['reupload-shared'] = true;
$wgGroupPermissions['confirmed' ]['minoredit'] = true;
$wgGroupPermissions['confirmed' ]['delete'] = true;

Enabled image uploads by making this statement true:

$wgEnableUploads = true;

Added a line to allow the wiki to generate thumbnails.

$wgMaxShellMemory = 524288;

Added a line to run a meta tag extension (also needed to add the meta.php file to the Extensions folder). Lets me include a meta tag for the main page description, but doesn't seem to work for the page title (wiki uses TITLE tag anyway, not META):

require_once('extensions/meta.php');

Cached pages for quicker rendering (only does this for unregistered visitors, but I guess that would be most of the traffic).

$wgUseFileCache = true; /* default: false */
$wgFileCacheDirectory = "$IP/cache";
$wgShowIPinHeader = false;

When setting up the Wiki originally, I could pick a type of license, but picked none. To add a Creative Commons license, I configured these lines as follows (and put a logo image in my backup folder):

# $wgEnableCreativeCommonsRdf = true;
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
$wgRightsText = "a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License";
$wgRightsIcon = "http://flashlight-wiki.com/backup/creative-commons-icon.png";

I wanted to be able to do footnotes like they do in Wikipedia, so I had to add the Cite extension by downloading a compressed file, putting it in my extensions folder, and extracting it. Then I had to add this line to the end of localsettings:

require_once("$IP/extensions/Cite/Cite.php");

I decided to add some AdSense ads to the page just to see if I get any revenue. There is a MediaWiki extension set up for it, so I unzipped that in the Extensions folder. I also needed to set up a new ad in AdSense that was 120x240. This generated some code for the ad, but I only needed a few key parts of the code, adding the following to localsettings.php. The last line is an option that hides ads from registered users, but I'd like to see what ads are showing up, so it is commented out. The instructions said to make a change to main.css, but I didn't do that (couldn't find main.css at first, but it is in skins/monobook) and it seems to work fine:

require_once( "$IP/extensions/GoogleAdSense/GoogleAdSense.php" );
$wgGoogleAdSenseClient = 'ca-pub-8914738878891900';
$wgGoogleAdSenseSlot = '2337837216';
$wgGoogleAdSenseID = 'flashlight';
// Show the AdSense box only for anonymous users
#$wgGoogleAdSenseAnonOnly = true;

I wanted to have some kind of filter to keep bots from registering, so I installed the extensions ConfirmEdit and ASIRRA, adding the following lines to the end of the file (also modified ConfirmEdit.php to act only for new user registrations):

require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
require_once( "$IP/extensions/ConfirmEdit/Asirra.php");
$wgCaptchaClass = 'Asirra';

Once I prevented bots from registering, I wanted to delete the bots that had signed up already, but you aren't supposed to just delete users, so instead you can merge the users and then delete them (this probably matters more if users had made any edits, but the bots were never confirmed, still better safe than sorry). So I downloaded and installed the User Merge and Delete Extension, adding the following lines to localsettings, and then commenting them out once I had merged everyone.

# require_once( "$IP/extensions/UserMerge/UserMerge.php" );
# $wgGroupPermissions['bureaucrat']['usermerge'] = true;

Lastly, I had to add these two lines to allow short URL's (using unrecommended method (also had to modify .htaccess to make this work, see next section):

$wgArticlePath = "/$1";
$wgUsePathInfo = false;


Modifications to .htaccess file

First, when using an add-on domain like this, there are a lot of ways to see the web pages, and I only want people to be able to see them as http://flashlight-wiki.com/stuff

But since it is a subdomain *and* and add-on domain, people could get to by seeing the subfolder on igirder http://igirder.com/flashlight-wiki/stuff as well as http://flashlight-wiki.igirder.com/stuff, so these lines in my .htaccess file redirect both of those (code from here, but I adapted it to get rid of the www. prefix on the destination):

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?flashlight-wiki\.igirder\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^!www\.flashlight-wiki\.com [NC]
RewriteRule ^(.*)$ http://flashlight-wiki.com/$1 [R=301,L]

After that add these lines to redirect www.flashlight-wiki.com to flashlight-wiki.com (not sure what the second two lines do):

RewriteCond %{HTTP_HOST} ^www.flashlight-wiki.com [NC]
RewriteRule ^(.*)$ http://flashlight-wiki.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/flashlight-wiki($|/.*$)
RewriteRule ^.* http://flashlight-wiki.com%1 [R=301,L]

To get short URL's to work, I had to make the changes shown just above to localsettings, but I also had to add this to the .htaccess file (for Wiki's installed to root directory, which is what I did originally, not knowing any better). I did this after the stuff above so as to at least hopefully get people in close to the right format of URL before attempting any of this:

RewriteRule ^[^:]*\. - [L]
RewriteRule ^[^:]*\/ - [L]
RewriteRule ^/*$ /index.php?title=Main_Page [L,QSA]
RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]

Changes to Main.css

I thought it would be good to have internal links one color and external links the traditional blue (purple if a link has been visited before). Wiki also has red links for links to pages that don't exist yet (dark red if you've tried to visit the page before). So I thought green would be good, but it was kind of hard to do light green and dark green, so I did dark green for unvisited internal links and brown for visited links. To do this, I had to change the main.css file under the skins/monobook folder. Technically you aren't supposed to change main.css because it is part of the installation and this should be done with a separate css file. So if I upgrade or change the skin, I will have to make these changes again. There doesn't seem to be a special class for internal links, so instead I set the general links to green and brown and then set new external links to blue and purple. So I revised these existing lines to read:

a {
text-decoration: none;
/* was color: #002bb8; */
color: #006600; /* dark green */
background: none;
}
a:visited {
/* was color: #5a3696; */
color: #663300; /*brown*/
}

Then I added these lines after that:

:link.external {
color: #002bb8;
}
:link.external:visited {
color: #5a3696;
}

Somewhere I read that when changing link colors you should use :link instead of A because A can be anchors, not just links. While I was messing around with colors, I also made the background color an off white (light yellow) by modify this line near the top of main.css:

#content {
background: #ffffdd; /*was white*/

Prefs that I modified
http://***/MediaWiki:Prefs-help-realname

Changed this to warn people registering that their accounts will not be activated until they send me an e-mail or PM at CPF or BLF.

Things I still want to do:

Enable multiple languages or at least a translation button. A guy from a Spanish language flashlight site said he would do some translating if I could enable other languages like Wikipedia does. The only way to get true multi-language support is to install a wiki for each language and have a "family" of wikis.

Change the title of the main page from Main Page - Flashlight Wiki to just Flashlight Wiki to maybe help search engine ranking. I think this will require changes to a javascript file (since it only applies to the Main Page, it has to be written as an IF statement), but I couldn't find out where to do that.

I'd like to set up support for equations, but my first try to do that wasn't successful (see comment of Jan. 2, 2011).

File size uploads are restricted to 2MB by default, but I'd like to change that to 500kb or smaller so people don't upload giant images. This might require tweaking server settings that I don't have access to though.

Comments (11)

re: "Find out why the domain isn't showing up in my web stats."

It may take up to a week or even month to get into the reporting queue with your host. There must be some batch process that moves traffic to the reporting data.

To get short URL's that would look like

http: //flashlight-wiki.com/wiki/Main_Page

instead of

http: //flashlight-wiki.com/index.php?title=Main_Page

the wiki has to be installed in a subdirectory (which I hadn't done; it was in the root) and then you make some changes so that the wiki uses a virtual directory called "wiki". This is how Wikipedia does, but I have always thought it was just wrong to have the /wiki/ in the URL. But I was going to go along with it anyway because they have some reasons for it. But since my wiki was already installed in the root, I tried to move stuff to a new subdirectory (didn't work), then move everything but the localsettings.php file to the subdirectory (didn't work) and even tried reinstalling MediaWiki to the sub-directory. But the reinstall had some unintended consequences, I believe because I didn't answer everything exactly the same in the setup options page. So I wound up finding some good instructions (links added to main article above) that seem to work just fine for allowing me to have URL's without the /wiki/ and with the wiki installed to the root. So good for me and now the URL looks like:

http://flashlight-wiki.com/Main_Page

The only consequence was I had a page for a flashlight testing procedure called ANSI/NEMA FL-1, and while it worked fine before having a slash in a name, now it does not. So I had to change that article to ANSI-NEMA FL-1. Also I moved the favicon.ico file from the root (where requests for it might be re-directed to the wiki) to the now empty "backup" folder, and revised the path in localsettings while I was at it. Whew!

The other benefit of this is I was trying to use Browse Later on my iPod to download a copy of the site and it didn't work because I think Browse Later (or Safari) doesn't like having ? in the URL. Now, without that, it downloaded just fine and I can carry the Flashlight Wiki around with me just I like I do Wikipedia (except I get pictures too!)

Well, after talking with the web hosts, we figured out that while flashlight-wiki.com doesn't show up in the stats, the stats are showing up under flashlight.igirder.com because it is an add-on domain I guess (though subdomains of addon domains show up correctly). So I can take that off the list.

I'm not getting a lot of traffic (probably isn't much interest honestly), but I'm moving up in the rankings. Now if you search for flashlight wiki, my page is on the first page of results.

Finally got my redirects to work correctly with some different lines in the htaccess file. Before it would redirect pages starting with www back to the home page instead of to the correct page, just without the www in front. Spent a loooonnnnnggg time trying to figure a way to get rid of "Main Page -" out of the browser title of my main page and got nowhere. There's an extension that seems to do it, but the website where you get the files has been down for a month. I don't know why that is so hard.

Google has a bunch of results with the different domain variations and while Yahoo has the home page listed very high when searching for Flashlight Wiki, they don't seem to have much else indexed.

I played around with the Main Page today. Since it was basically just a list of topics in the Wiki, it was long and narrow. I was thinking I could put a picture on the right side which was otherwise just wasted space and then thought I could maybe use two columns instead. I looked up how I could do this and first tried a table which didn't work because the contents were centered vertically and one column is always shorter than the other. Plus Wiki tables are maybe just as bad or worse than HTML tables. Then I found out about CSS float tags and used those to set up two columns. Then I tweaked it a little further to provide a third column as gutter of 4% between the two main columns.

Also, since most people can probably see all the contents now without scrolling I found out I could get rid of the automatically generated Table of Contents just by writing __NOTOC__ somewhere on the page. It's more cluttered looking, but I think it is an improvement.

I like the columns on the main page. That's what I wanted to do on fiveforks wiki, but didn't know how.

I had a very simple equation I wanted to add to one page, so I looked into what it would take to do that. Seems like it should be simple since they even have an equation button in the default editor. Not so. I tried a few things before giving up. You have to install a special executable and some of this seem to require work from a server administrator (at my hosting company). For some reason then you have to compile some stuff on the server. Anyway, I wound up just using Microsoft Word to build the equation, took a screen capture, and inserted the image. This is sort of what the equation executable does since some equations are just made into graphics by it. More here.

I added some small AdSense ads to the Flashlight Wiki today. I get over 100 a visitors a day, which isn't much, but a lot of them are looking to buy stuff, so I thought I'd try it out. I put the changes I had to make in the article above. Once I found the right extension, it was pretty easy. Other than time, the only cost of the Wiki is for the domain and that is only $8 a year. I already had a web hosting plan that allowed me to add it for free.

AdSense was kind of interesting. Whereas my other pages might get 50 views a day, the wiki ads got several hundred per day because they were on a lot of different pages. But despite the ads relating to flashlights, I didn't get any clicks, so I commented out the AdSense lines in localsettings. It will be easy if I want to add them back.

Added ConfirmEdit and ASIRRA to prevent bots registering and then having to be blocked.

Decided to put the AdSense ads back a month or so ago and have gotten a couple of clicks.

I wanted to change the contents of the sidebar on the site. There is a link to a "community portal" and "current events" which I wasn't using. So I wanted to put links to two pages that are pretty good: a dictionary of words and a list of flashlight manufacturers.

To make the change I had to be logged in as an admin and type in the URL:

flashlight-wiki.com/MediaWiki:Sidebar&action=edit

This gave me a page that is in non-wiki format. Easy to change using guide here.

Post a comment