My cousin, Mary, invited me to be her Facebook friend today and I gladly accepted. On her page she had a link to 2012 as the Year of Code, saying her New Year’s resolution was to learn more code. At the link they had a quote by someone saying:
A young person asked me for advice for “those who aren’t technical.” My answer was “Get technical.”
I was looking for a way to put meta tags in the flashlight wiki’s home page. You don’t see meta tags, but they are in a web page’s source code. Search engines like Google and Bing see the meta tags and will use them when determining which pages to show people who are doing searches. There are different kinds of meta tags, but probably the most useful is the Description which allows you to give a brief description of your page. When Google shows page results, it will show this description under the link to your site, so that can be helpful to people deciding which of Google’s results to click. Another meta tag is for keywords that relate to topics on your page, but Google is pretty good about finding keywords on your page by itself. I don’t know that you need a description or keywords for every page since the other pages have topical page titles and their own vocabulary of keywords for Google to find, but I think it is good for the home page.
When I first set up the wiki, I had an extension (kind of a helper program to the wiki software) that let me add meta tags to a page by editing a wiki page. Unfortunately, when I upgraded the MediaWiki software to the latest version, that extension no longer worked. And worse, it caused the home page to just become an error. So I got rid of that extension and started looking for another one. Unfortunately, a lot of the extensions are not being updated and seem to be having problems with the new software. However I did find one called MetaDescriptionTag that lets you add a description in a special tag like this:
<metadesc>This page is the best page ever!</metadesc>
Well, that was exactly what I wanted. But its developer had stopped updating as well. Fortunately, a user at MediaWiki had updated the software on their own for the latest version of MediaWiki. Rather than mess with the original unupdated work, they made it available as a past revision of that page (that page being a wiki, so it keeps track of all past revisions). I copied the code into a .php file, told my installation to use it, added the appropriate metadesc tag to my main page, and checked the source for the page. And there was my meta tag!
Next I thought I would try to find an extension that would do meta keywords. And I did find one called MetaKeywordsTag that seemed to use essentially the same code that MetaDescriptionTag had used, except it was producing a meta tag for keywords. However, it too had not been updated and was using the old commands that no longer worked. But that got me thinking that if the two were so similar I could probably just swap out the word “metadesc” for “metakey” in the code. Actually I did a few case sensitive searches and got rid of all the description words and replaced them with keyword words. Except that the code has a description of what the extension does and I had to leave that “description” in place.
It didn’t work right away because I had some typos. And I found that when I fixed the extension, I was still getting the error. It turns out I had to go back and re-edit the wiki page’s source and save it again, even though there was nothing wrong with the source. This forced the extension to go into action, otherwise the cached version of the page was being used. I could tell this because there was a tag of gibberish in the HTML of the page that was being generated by the extension and it wasn’t changing, even though it should have been. The gibberish itself was an HTML comment that you can’t see unless you look at the HTML source code.
That gibberish got me wondering why it was needed and why the extension couldn’t just insert the meta tag without it. It turns out the wiki software has a way of making some meta tags on its own and the wiki was making these new tags, not the extension. But the gibberish was an instruction to the wiki software to put the meta tag there. In fact the gibberish was a 64-bit version of the text of the description or the keywords, which I was able to confirm with this 64-bit to ASCII converter tool:
http://www.hcidata.info/base64.htm
Thus it went from:
<!-- META_DESCRIPTION SW5mb3JtYXRpb24gYWJvdXQgZmxhc2hsaWdodHM
sIGZsYXNobGlnaHQgcGFydHMsIExFRCdzLCB0b3JjaCBtYW51ZmFjdHVyZXJz
LCBwcmltYXJ5IGFuZCByZWNoYXJnZWFibGUgYmF0dGVyaWVzLCBhbmQgY2hhc
mdlcnMu -->
to:
Information about flashlights, flashlight parts, LED’s, torch manufacturers, primary and rechargeable batteries, and chargers.
Reading through the documentation on the extension, they mentioned an “excellent article by Jim R. Wilson” that explained how the extension works. So I visited that site where he explained about parsers and hooks (no idea) and that the gibberish is generated and cached with the page when the last person who edits the wiki page saves their changes. That is why updating the extension didn’t change the page: because the extension is only used when you save the wiki page. Then the page rendering software sees the gibberish and knows to turn it into a meta tag, converting the gibberish into the content of the tag. As an example project, the article mentions creating an extension called MetaKeywordsTag (plural Keywords). So that’s funny because the MetaDescriptionTag, which I used to create my MetaKeywordTag, is actually based on MetaKeywordsTag. I wound up inadvertently re-creating the original (except mine works). Thinking maybe other people would like a working meta keywords extension, I renamed my extension MetaKeywordsTag like the original and added a link to it on the MetaKeywordsTag page at WikiMedia. I didn’t want to overwrite the original version (which is stored on the author’s personal wiki, which has not been updated since 2009), but I didn’t want anyone to have to go through what I went through either.