MediaWiki On This Day

From Wiki @ Karl Jones dot com
Revision as of 14:59, 9 August 2016 by Karl Jones (Talk | contribs)

Jump to: navigation, search

MediaWiki On This Day refers to the "On This Day" feature (and similar features) in MediaWiki.

On this Day.... how to do that

In short: Each day-entry is created manually as subpage. They're displayed via a date check using Extension:ParserFunctions.

DailyFeaturedPage extension

Display a randomized Article of the Day

To get this working, copy the source of this page to your Template namespace and then transclude it where desired.

This template generates a pseudo-random article for today. The article selected is based on today's date so that the article will remain constant for one day but change automatically the next day. This is done by getting the number of seconds from epoch until the beginning of today, doing an expression on it and then modding it by the number of articles in the wiki. So the final result is a pseudo-random number between 0 and the (number of keywords in the wiki - 1). Then it uses that result as an offset to retrieve that number article in the wiki based on the order returned by the ask query. In truth, the article selected will change on a day that the number of articles in the wiki changes.

The sample query in this page will pick from all articles in the main namespace. You can customize the queries to select whichever pages you'd like. (You must modify both ask queries to select the same set of pages.)

See also