How to check from a template if a page is in a given category?

Jump to: navigation, search

Hi, I'd like to write a template for Wikisource with a code that would check if a book (page "Index:Book") is in the "Category:Finished" (fictional category name), and then change an icon accordingly. Is there a magic word for that? Or any other way to do it?

Micru22:54, 6 February 2012

Not really no (possible to write extension to do that, but no such extension is installed on Wikimedia Wikis at the moment). I suppose DynamicPageList does something kind of close, and might one day be able to do that, but as it stands, cannot.

You could maybe put a book's status in a subpage, (Aka Index:Book/status is a page containing just Finished or whatever ) and then use templates to get the value of that and do stuff based on that (possibly including detemining Index:Book's category based on the content of the subpage).

Bawolff07:14, 7 February 2012

Thanks for the advice, Bawolff. I found this template on the italian wikisource that does what I wanted. However I'll have to read the code a couple of times because I still don't fully understand the procedure it uses.

Micru08:34, 7 February 2012
 

Extension:PageInCat, no?

Subfader14:54, 7 February 2012

Not yet, but that would probably make a good feature for that extension.

(Basically PageInCat can only detect if the current page is in a category. It can't detect if an arbitrary page is in some category)

However, even if PageInCat did support Micru's request, the extension is not installed on Wikimedia, so can't be used on wikisource.

Bawolff15:42, 7 February 2012
 
 
Personal tools

Variants
Actions
Navigation
Support
Download
Development
Communication
Toolbox