Extension:DynamicPageList (Wikimedia)/ja

From mediawiki.org
This page is a translated version of the page Extension:DynamicPageList (Wikimedia) and the translation is 41% complete.
MediaWiki 拡張機能マニュアル
DynamicPageList
リリースの状態: 安定
実装 タグ , パーサー関数
説明 あるカテゴリに属するアイテムあるいは複数カテゴリに共通して属するカテゴリの中で、最も新しいものからいくつか箇条書きで出力します。
作者 IlyaHaykinson and Amgine
最新バージョン Continuous updates
互換性の方針 MediaWiki とともにリリースされるスナップショット。 master には後方互換性がありません。
MediaWiki 1.23+
PHP 5.4+
データベースの変更 いいえ
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード

  • $wgDLPmaxCategories
  • $wgDLPMaxCacheTime
  • $wgDLPAllowUnlimitedResults
  • $wgDLPAllowUnlimitedCategories
  • $wgDLPQueryCacheTime
  • $wgDLPMaxResultCount
  • $wgDLPMaxQueryTime
‎<DynamicPageList>
Public wikis using 813 (Ranked 314th)
DynamicPageList (Wikimedia) 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · (Wikimedia) バグを報告
この拡張機能はWikimediaで使われていますが、Extension:DynamicPageList (third-party) Extension:DynamicPageList3 と混同しないようにしてください。

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

起源

もともとはWikinews用に開発されたものです。現在、ほとんどの言語のWikinewsプロジェクト(n:Wikinews:DynamicPageList)、Meta、MediaWiki.org、その他いくつかの小さなプロジェクトでインストールされています。 これは性能上の問題から、これ以上ウィキメディア・ウィキにインストールされることはないでしょう

以前はDynamicPageList/oldと呼ばれ、その後Intersectionと呼ばれていました。より高機能な DynamicPageList3 にも興味をお持ちかもしれません。

インストールと設定

インストール

  • ダウンロードして、ファイルをextensions/フォルダー内のintersectionという名前のディレクトリ内に配置します。
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/intersection
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'intersection' );
    
  • Yes 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

設定

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

# Configuration variables. Warning: These use DLP instead of DPL
# for historical reasons (pretend Dynamic list of pages)
$wgDLPmaxCategories = 6;                // Maximum number of categories to look for
$wgDLPMaxResultCount = 200;             // Maximum number of results to allow
$wgDLPAllowUnlimitedResults = false;    // Allow unlimited results
$wgDLPAllowUnlimitedCategories = false; // Allow unlimited categories
// How long to cache pages using DPL's in seconds. Default to 1 day. Set to
// false to use the normal amount of page caching (most efficient), Set to 0 to disable
// cache altogether (inefficient, but results will never be outdated)
$wgDLPMaxCacheTime = 60*60*24;          // How long to cache pages in seconds

使用法

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

<DynamicPageList>
category             = Pages recently transferred from Meta
count                = 5
order                = ascending
addfirstcategorydate = true
</DynamicPageList>

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

<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
</DynamicPageList>

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

ページ選択

category

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

category=category nameとして記述します。

<DynamicPageList>
category = Demo
category = Demo 1
</DynamicPageList>

notcategory

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

<DynamicPageList>
category    = Demo
notcategory = Demo 1
</DynamicPageList>

namespace

namespace で列挙する記事が属する名前空間を指定できます。名前空間の名称または番号(Help:Namespaces/ja#名前空間の識別参照)をつけて指定できます。無効な名称を指定した場合は標準名前空間が指定されたものとして扱われます。

<DynamicPageList>
category  = Demo
namespace = Help
</DynamicPageList>

redirects

redirects転送ページを含めるかどうかを指定します。 この値は、exclude (既定、リダイレクトを列挙しない)、include (リダイレクトを列挙する)、only (リダイレクト以外のページを列挙しない) のいずれかです。

<DynamicPageList>
category  = Demo
redirects = only
</DynamicPageList>

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.

<DynamicPageList>
category = Demo
count    = 2
</DynamicPageList>

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.

<DynamicPageList>
category = Demo
offset    = 2
</DynamicPageList>

コラムデモ

<table>
<tr><th colspan="3"> recent articles in [[:category:Demo|:category:Demo]]</th></tr>
<tr><td>

<DynamicPageList>
category = Demo
count=5
</DynamicPageList>
</td>
<td>
<DynamicPageList>
category = Demo
offset    = 5
count= 5
</DynamicPageList>
</td>
<td>

<DynamicPageList>
category = Demo
offset    = 10
count=5
</DynamicPageList>
</td></tr></table>

表示内容

見せかけの空間

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 ).

<DynamicPageList>
category      = Demo
shownamespace = false
</DynamicPageList>

最初のカテゴリを追加した日付

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.

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

mode

mode determines the format of the list. The value can be:

  • unordered — 箇条書きリスト
  • ordered — 番号付きリスト
  • none — プレーンリンク
  • gallery — イメージギャラリー、‎<gallery>のような
  • inline — カンマ区切りリスト
unordered:
<DynamicPageList>
category = Demo
mode     = unordered
</DynamicPageList>

ordered:

<DynamicPageList>
category = Demo
mode     = ordered
</DynamicPageList>

plain links:

<DynamicPageList>
category = Demo
mode     = none
</DynamicPageList>

inline:

<DynamicPageList>
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.

<DynamicPageList>
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).

addfirstcategorydate が使用されている場合、画像のキャプションに日付が付加される。

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

複雑なギャラリーの例としては、こんな感じでしょうか。

<DynamicPageList>
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:
<DynamicPageList>
category       = Dem
suppresserrors = true
</DynamicPageList>

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

nofollow

nofollow sets rel="nofollow" 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/$wgDefaultRobotPolicy . 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.

<DynamicPageList>
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 [1], so this appends ?dpl_id=<id of article> 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.

<DynamicPageList>
category       = Demo
googlehack       = true
</DynamicPageList>

Order

ordermethod

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

  • categoryadddefault, sort by date pages were categorised for first category
  • lasteditsort by date pages were last edited
  • lengthby article length
  • createdby article creation date
  • categorysortkeyessentially alphabetical order by the sort key of the first category
  • sortkeyalias 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—specifically, categoryadd and categorysortkey fallback to created if there is no category clause.

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

alphabetical example:

<DynamicPageList>
category             = Demo
ordermethod          = sortkey
</DynamicPageList>

order

order にて並べ替えの昇順/降順を指定できます。 値は、descending (既定、新しい順)、ascending (古い順) のいずれかです。

<DynamicPageList>
category  = Demo
order     = ascending
</DynamicPageList>

テンプレート

To use inside a template and pass parameters, use parser functions etc., use the {{#tag: function:

{{#tag:DynamicPageList|
category = {{{1}}}
count    = {{#if: {{{2|}}} | 10 | 20 }}
ordermethod = sortkey
order = ascending
}}

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

エラー: カテゴリを少なくとも1つ含めるか、名前空間を指定する必要があります!


Derived extensions

  • Derived extensions: DPLforum outputs in forum style. Extension:GoogleNewsSitemap is like this but outputs an RSS feed. DynamicPageList (third-party) 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 DynamicPageList (third-party) 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 ordermethod=sortkey.
  • Extension:DynamicPageListEngine - makes dynamic page lists available to Scribunto modules.