Extension:BedellPenDragon

The BedellPenDragon extension is like a combination of Extension:Random In Category and the example page_props metadata extension, with glossary and essay list special pages added on. The extension makes available a  tag and parser functions to allow pages to add or remove metadata to/from the page_props table. It is designed to be used in conjunction with Extension:CategoryGallery and Extension:RecentPages, if you want additional functionality.

Usage
The most obvious uses of this extension are as follows:

Glossary and essay list
Go to http://polywiki.org/wiki/Special:Export. Click "Include templates" and export the following: MediaWiki:Essaylist-intro MediaWiki:Glossary-intro Template:EssayAuthor Template:FASummary Template:FESummary Template:InvisiblePageSummary Template:InvisibleNoGlossaryPageSummary Template:New articles at PolyWiki Template:NoGlossaryPageSummary Template:PageSummary Template:Randomly featured article Template:Randomly featured essay Template:Randomly featured quote Template:TFAPic Go to Special:Import on your wiki and import the .xml file you got from PolyWiki. You should now have all the templates you need to start making your articles and essays add entries to the glossary and essay list, respectively. It's quite an accomplishment; congratulations! You just won yourself a prize, Enforcer!

Random page in category
To get the page title of a random page in Category:Aubry, use, e.g.: 

Or to get a bulleted, wikified, sorted list of 12 random page titles from Category:Nathan Larson essays:

]] *[[

Load that into a wikipedia:Template:Sidebar like this (although ideally you'll find a way to make the page titles wrap if they get too long, rather than making the sidebar expand to fit them on one line apiece; please improve upon this example if you can):

It'll give you something like this:



Or to get the content of a randomly-chosen page from Category:Featured quotes with s 1 and 26 excluded:



Parameters
The input, i.e. the text between the opening and closing tags, overrides the delimiter parameter.

Today's featured article
Create a Template:TFAPic like this:

Create a Template:FASummary like this:

Create a Template:Randomly featured article like this: 

Start your featured article (e.g. polyamory) like this:



Transclude Template:Randomly featured article to your main page and you'll get something like this:



"New Pages" or "Did You Know" descriptions via metadata from the pages themselves (requires RecentPages extension)
You'll need Extension:RecentPages for this.

PageSummary template and New Pages display of pages with that template
You probably want to create a page summary template (Template:PageSummary) like this: That way, you can write your wiki pages like this:



Notice how this creates two summaries separated by a pipe; the short summary is the first sentence, while the long summary is the first sentence followed by the rest of the summary. You can then use the Recent Pages extension to create something like this, which you'll put in, e.g. Template:New articles at PolyWiki‎: 

This will produce a result like this, when inserted into the appropriate main page template (e.g. one you can borrow from Main page):



(See Extension:RecentPages for an explanation of the  tag parameters used above.) You'll probably also want to create a Template:InvisiblePageSummary like this:

Then you can create wikitext like this, that uses a different page summary than what you put for the article lead. E.g., in this case it was necessary because the article lead had wikified words in the page title:
 * The distinction between polyamory and swinging is that at the core, polyamory is about multiple, consensual, sexual, loving relationships while swinging is multiple, consensual, sexual relationships.

List of new unsummarized articles
You then want to create a PolyWiki:New articles without summaries:

The following is a list of new articles in need of summaries: 

You will get a result like this:



CategoryGallery with captions generated from image description files (requires CategoryGallery extension)
You'll need Extension:CategoryGallery for this. Place image descriptions on your image file pages (e.g. File:Popsicle stick Eiffel Tower.jpg) using the same PageSummary template as before. Now, on the page where you're putting the gallery, use e.g.:



The result is as follows (note how the captions are generated using the metadata you saved on each image page):



When I use in a nested table I get a bunch of repeating nested tables.
Yeah, the problem there is that the pages that are transcluding the category are for some reason being included in the pool of pages from which one is randomly selected. When one of those transcluding pages gets picked, you end up with those repeating nested tables. The solution is to find out the page IDs of those transcluding pages and then use the "exclude" parameter. E.g., exclude="1,26" if you're trying to exclude pages 1 and 26. It's an awkward solution and it'll mess up if, for instance, you delete one of those pages and undelete it, giving it a new page ID. But I haven't figured out a better way to approach the problem; see Extension:BedellPenDragon.

FAQ
===I want to have a random article or an excerpt thereof (if it's a long article) display on the main page, sort of like wikipedia:Wikipedia:Today's featured article. Is this the right extension to use?=== It depends on exactly what you're trying to accomplish:
 * Do you want to have any article on the wiki, regardless of quality, be eligible to appear on the main page, with the only standard being (perhaps) that it's of a certain minimum length? E.g., do you have such a large selection of articles you want to be eligible to be displayed as featured articles that it would be impracticable to maintain a centralized list or to add them as members of a Category:Featured articles? Then Extension:Blurb might be the extension you want.
 * Do you have a pretty short list of articles that you want to have be eligible to appear on the main page, and you don't mind editing a page containing a centralized list every time you want to add or remove articles from the list? Then Extension:RandomSelection might be the one you want. See http://wiki.mises.org/wiki/Template:Featured_article for an example of RandomSelection in action.
 * Do you want to have articles be displayed as featured articles if and only if those articles are members of, say, Category:Featured articles? Then BedellPenDragon is the extension you want.

With reference to, why does the "exclude" parameter have users specify page IDs rather than page titles, and why isn't there a "namespace" parameter?
Developer laziness, and also the fact that does not have the necessary fields to make it as simple a matter as just adding another condition to a SELECT database query. This extension was mostly designed for small wikis with only a few users, at most, who would need to know how to use that tag. Make good use of the PAGEID magic word to find out page IDs, if you need to. Then of course there's the API; see e.g. https://www.mediawiki.org/w/api.php?action=query&prop=pageprops&titles=Extension:BedellPenDragon. In the long run, page metadata features, perhaps involving Wikidata, are supposed to be developed that are better and more scalable.

Should this extension be rewritten to use a Summary: or Metadata: namespace instead of the page_props table?
It's an interesting idea (and Extension:ExplicitDescription does something like that), but then you'd need to make more than one edit, to more than one page, if you're changing both the page content and the page metadata. This isn't unheard of; for example, when you move a page, you already often have to make more than one change (i.e. (1) actually moving the page and (2) changing the page content to reflect the new title).

The fact that there might be other metadata besides just the page summary suggests that you might want to call it a Metadata: namespace. However, RationalWiki does have a Summary: namespace, mostly for discussion threads.

===Unlike Extension:Advanced Meta, this extension doesn't have a separate description inputbox in the edit screen, but rather it uses description templates that are part of the page contents. Nor does it have a separate ext_meta table; instead, you clog up the page_props table. Why is that?=== If you store the description stuff separately from the page content, then it complicates the process of importing it into another wiki, if you ever wanted to do that. It would be necessary to add new API functionality and/or modify the code implementing Special:Import and Special:Export. The way it is now, you can just transfer over the templates and page content and it works. I'm not saying that's the best solution, but any other solution would be more complicated and require further development.

This extension was mostly designed for small wikis, so it wasn't deemed necessary to create a new table. Certainly that might be a good idea if, say, this extension were to be used on Wikipedia, but I would hope WMF would come up with a more elegant metadata solution, since they've already decided to go the Wikidata route.

Why is there not a special page similar to Special:AllPages, except that it lets you list all the pages with their summaries or other metadata?
I've never been able to successfully do a JOIN in MediaWiki, except this one time when I hardcoded a raw SQL query into Extension:Chat (see the code that starts with ). If I could figure out how to do the necessary JOIN or UNION or whatever it is that's necessary to implement this, I would do that. I'm really not all that skilled with that intermediate SQL stuff. If you can come up with the query, and better yet, show me how to use the database wrappers to implement the query, then I'll get crackalackin on that right away. See 56604, by the way.

Should this extension be regarded as fixing bug 23016?
Sort of, but there are many possible ways to fix that bug, and it's not clear that this is the best way.

Why use this instead of Semantic MediaWiki?
Because SMW is buggy and its support website blows. SMW might be more powerful and easier to use, though, until you run into something that it's not capable of handling.