Extension:DynamicPageList (Wikimedia)/ja


 * この拡張機能はWikimediaで使われていますが、やと混同しないようにしてください. 

動的ページリストの拡張機能を使うとあるカテゴリに属するページを列挙したリストページをつくることができます. 全般的な情報についてはm:Help:DPLを参照してください.

起源
この拡張機能は元々ウィキニュースのために開発されたものです. 現在は全言語のウィキニュースプロジェクト（n:Wikinews:DynamicPageListをご覧ください）、メタウィキ、ウィキブックス、ウィキバーシティにインストールされていて、またあらゆる中小サイズのウィキにインストールすることができます（非常に大きなウィキでは拡張性に問題があることが知られています）.

以前はDynamicPageList/oldと呼ばれ、その後Intersectionと呼ばれていました. より高機能なサードパーティー製DynamicPageListにも興味をお持ちかもしれません.

設定
この拡張機能は複数の設定変数にも対応しています. 通常は初期値のまま使いたいと思うでしょうけど、「LocalSettings.php」のrequire_once行よりも後に追記すれば設定を変更できます. 以下に設定できる変数とその初期値を示します.

使用法
DynamicPageListの設定は、ウィキの編集画面でXMLに似た文法を使って記述できます. 設定変数によって表示するページリストの数、順序、表示モードを変更できます. 各設定変数については以下の節を参照してください. 例えば、このウィキで最近MediaWiki.orgに移されたページを古いものから5つ表示するには次のように記述します.

 category            = Pages recently transferred from Meta count               = 5 order               = ascending addfirstcategorydate = true 

もっと複雑なDynamicPageListの例です.

 category=foo count=20 namespace=file addfirstcategorydate=ymd imagewidth=70 galleryshowfilesize=yes galleryshowfilename=yes imagesperrow=7 gallerycaption=Galleries! ordermethod=sortkey order=ascending mode=gallery offset=12 

上記の例は、fooカテゴリに属するファイル名前空間にある12番目から34番目のページを、画像ギャラリー形式で、fooカテゴリに追加された日付を年月日の書式で見出しにつけ、画像の幅は70pxにして表示するという例になります.

カテゴリ
categoryにて条件に入れるカテゴリを指定します. DynamicPagelist構文に入れたすべてのカテゴリが指定されます. 指定できるカテゴリの数の範囲はこの拡張機能のソースコードに規定されています. カテゴリ名にマジックワードを指定できます.

として記述します.

 category = Demo category = Demo 1 

notcategory
notcategory restricts the list of pages to those not in a particular category. You can use magic words like August in the category name.

 category   = Demo notcategory = Demo 1 

名前空間
namespace restricts the list of pages specified above to those in a particular namespace, specified by name or number (see the List of default namespaces). Any invalid name is equivalent to the main article namespace.

 category = Demo namespace = Help 

redirects
redirects determines whether or not to include redirect pages. The value can be exclude (default, don't list redirects), include (list redirects), or only (don't list pages that aren't redirects).

 category = Demo redirects = only 

stablepages
stablepages determines whether or not to include stable (flagged) pages when using Extension:FlaggedRevisions. The value can be exclude (don't list), include (list stable and non-stable. default), or only (only list stable pages). Requires FlaggedRevs to be installed to work.

qualitypages
qualitypages determines whether or not to include quality (flagged at the 'pristine' level) pages when using Extension:FlaggedRevisions. The value can be exclude (don't list), include (list both quality and non-quality), or only (only list quality pages).

Note: the behaviour of qualitypages changed from older versions. In older versions qualitypages=exclude automatically made stablepages=only be set. This is no longer the case.

count
count restricts the number of results that are shown. By default, the pages added to the category most recently are shown (see order). Note that the extension will not list more results than the maximum defined in the extension source code.

 category = Demo count   = 2 

offset
offset starts the list from somewhere other than the first page on the list. For example, this can be used with count to make multi-column layouts.

 category = Demo offset   = 2 

Column demo

shownamespace
shownamespace displays the namespace in the page names. The value can be true (default, display in name: Help:Contents) or false (don't display in name: Contents).

 category     = Demo shownamespace = false </DynamicPageList>

addfirstcategorydate
addfirstcategorydate shows the date each article was added to category. The value can be true (display date), false (default, don't display date), or a date specifier (ymd, md, dm, dmy, mdy, and ISO 8601). If many categories are specified, it uses the first category. The linked page names are prepended with the date formatted according to your local MediaWiki date display preferences.

 category            = Demo addfirstcategorydate = true </DynamicPageList>

mode
mode determines the format of the list. The value can be:
 * unordered — bulleted list
 * ordered — numbered list
 * none — plain links with line breaks
 * gallery — image gallery, like
 * inline — comma separated list

unordered:  category = Demo mode    = unordered </DynamicPageList>

ordered:

 category = Demo mode    = ordered </DynamicPageList>

plain links:

 category = Demo mode    = none </DynamicPageList>

inline:

 category = Demo mode    = inline </DynamicPageList>

mode=gallery
Gallery is a special mode where the output is an image gallery. If Extension:PageImages is installed, then the page-image if one exists will be used for non-file pages. Otherwise non-File namespace pages will just be a blank space.

 category = Demo mode    = gallery namespace= file </DynamicPageList>

Gallery mode also supports the options imagewidth (how wide the images should be in gallery, you may need to also set imageheight if using this), imageheight (how high the image should be) galleryshowfilesize (show the image size, like on category pages), galleryshowfilename (show filename like on category pages), imagesperrow (number of images per row in gallery), gallerycaption (caption for gallery).

If addfirstcategorydate is in use, the date is appended to the caption of the image.

Note, gallerycaption at the moment cannot accept links. (but it can accept things like August )

A complex gallery example might be:

 count=20 namespace=file addfirstcategorydate=ymd imagewidth=70 galleryshowfilesize=yes galleryshowfilename=yes imagesperrow=7 gallerycaption=Look at my pretty gallery. mode=gallery shownamespace=false </DynamicPageList>

suppresserrors
suppresserrors hides errors. The value can be true (hide errors) or false (default, show errors).

true:  category      = Dem suppresserrors = true </DynamicPageList>

false:  category      = Dem suppresserrors = false </DynamicPageList>

nofollow
nofollow sets  on the links. This prevents spiders from getting to the page through the link from the DynamicPageList. In general this is useless, as spiders will either be able to index the page from other links, or not at all due to robots.txt/. In general you should not use this option unless you know what you are doing, and have a good reason. The primary usecase is that on the English Wikinews, Google News considers anything linked from the main page to be an article.

 category      = Demo nofollow      = true </DynamicPageList>

googlehack
This is a hack for wikinews. Previously, Google News only considered articles with numbers in them to be news articles, so this appends ?dpl_id=&lt;id of article&gt; to the end of the urls on the list. You shouldn't use this option unless you have a good reason to (however it won't hurt anything). This replaces the showcurid option that is no longer supported.

 category      = Demo googlehack      = true </DynamicPageList>

ordermethod
ordermethod determines the order and date to display. The value can be:


 * categoryadd — default, sort by date pages were categorised for first category
 * lastedit — sort by date pages were last edited
 * length — by article length
 * created — by article creation date
 * categorysortkey — essentially alphabetical order by the sort key of the first category
 * sortkey — alias of categorysortkey

It should be noted, that lastedit really sorts by the last time the page was touched. In some cases this is not equivalent to the last edit (for example, this includes permission changes, creation or deletion of linked pages, and alteration of contained templates). If you do not specify a category, some of these order methods will not work&mdash;specifically, categoryadd and categorysortkey fallback to created if there is no  clause.

 category            = Demo addfirstcategorydate = true ordermethod         = lastedit </DynamicPageList>

alphabetical example:

 category            = Demo ordermethod         = sortkey </DynamicPageList>

整列順序
orderにて並び替え方を指定できます. descendingで降順(新しい順)、ascendingで昇順(古い順)になります. このパラメーターを指定しなければ降順に設定されます.

 category = Demo order    = ascending </DynamicPageList>

テンプレート
To use inside a template and pass parameters, use parser functions etc., use the  function:

テンプレートページ自体、タグで挟まないとカテゴリ値が空白のままのため、エラーメッセージを表示します. 例を示します.

Derived extensions

 *  Derived extensions: outputs in forum style.  is like this but outputs an RSS feed.  is a modified version with more features, but also more resource-expensive. Neither of the latter is used on Wikimedia's sites. 
 * Version 1.8.4 of is fully downward compatible with the extension described here. So the way is open for a re-unification of the different development paths. This is not true any more for the current versions since version 2.01 of DynamicPageList (third-party) does not support.
 * - makes dynamic page lists available to modules.
 * - provides similar functions.