Manual:Interface/Sidebar/ja

サイドバー defines the navigation bar, which provides links to the most important locations in the wiki and supplies site administrators with a place to add a persistent collection of links. For instance, most wikis will link to their community discussion page and some useful tools.

モノブックスキンでは、ナビゲーションバーは左(右から左に書く言語では右)に、検索バーとツールボックスと共に表示されるが、位置はスキンによって変わる.

サイドバーのカスタマイズ
As an administrator of your own wiki, to edit your own サイドバー, replace your wiki page's in the title bar with . (The editinterface permission needs to be enabled and is enabled for administrators by default; for information on assigning it to other groups, see 利用者権限.) You may need to use the syntax //yourdomain/yourwiki/index.php?title=MediaWiki:Sidebar&action=edit if you use long URLs.

If you are sure you are logged in with the relevant rights but do not see the edit link, click on the create tab at the top of the page - this will take you to the edit page.

サイドバーのコードの例:
 * navigation
 * mainpage|mainpage
 * 特別:最近更新したページ|最近更新したページ
 * 新しいへッディング
 * フォーラムのURL|フォーラム
 * http://www.mediawiki.org|MediaWiki ホームページ

見出し
ナビゲーションバーは、それぞれ固有のヘッディングを持つセクションごとに分割できる. それぞれのセクションのヘッディングはリスト要素の最初のレベルから取られる(上記の例では、"navigation"がその例である).

もしも、このテキストが、システムメッセージの名前に一致するならば、すなわち、そのタイトルのページがMediaWikiの名前空間に存在するならば、メッセージのテキストはラベルとして使われ、それ以外は、タイトルはそのままで使われる.

バグ: no sidebar is shown in the Nostalgia skin (bug 10794).

リンク
2番目のレベルのリスト要素はナビゲーションバー上のリンクに一致し、形式は以下の通り: ** リンクするページ(ターゲット)|リンクの文字(ラベル)


 * target
 * The link target can be the name of an interface message (page in the MediaWiki namespace) or wiki page, or an external link. In either case, the link can be internal, interwiki, or external. In some cases (such as links with the "&" character), an interface message is necessary. The link target cannot be made dependent on the interface language set in the preferences.


 * アルゴリズムは以下の通り:
 * Get the target text.
 * If there is an existing or default interface message with that name, use the content of that message instead of the target text.
 * If the output from the previous step is a valid URL (beginning with http:// or other URL protocol), the link will point to that URL.
 * Else, it will treat it as the link target of a wikilink (linking to that page name or interwiki).
 * In case it would end up linking to '-', the whole entry is removed from the sidebar (that's useful for removing an entry on all languages by changing the message holding the link).


 * 例:
 * " " uses the text of MediaWiki:Portal-url (which contains "").
 * " " links to Special:RecentChanges, since there is no interface message of that name.
 * " " links to Foo for the same reason.
 * " " links to http://www.mediawiki.org for the same reason.


 * text
 * The link text can be the name of an interface message (page in the MediaWiki namespace) or plain text.
 * If the link text is the name of an existing or default interface message, the content of that message will be used. MediaWiki will check for localized versions; for example, if the current language is fr (French) and the link text is the interface message "forum", it will check for "forum/fr" before using "forum".
 * Otherwise, the link text is used as the target as-is.
 * Notice that the link text is not optional as in normal wiki links. If the link text is missing, the item is ignored.


 * 例:
 * uses MediaWiki:Mainpage (which contains "").
 * uses "Recent changes", since there is no interface message of that name.

要素の順序
By default, the sidebar consists of elements in this order: navigation, search, toolbox, languages. The order can be changed (in MediaWiki 1.13+) by adding special keywords (SEARCH, TOOLBOX and LANGUAGES) to MediaWiki:Sidebar using the heading syntax. For example, the following code moves the search box to the top of the sidebar:
 * SEARCH


 * navigation
 * mainpage|mainpage
 * Special:RecentChanges|Recent changed
 * new heading
 * portal-url|portal
 * http://www.mediawiki.org|MediaWiki home

翻訳
You can translate the strings, which you use, by editing the according pages in the MediaWiki namespace.

例: The string, which will replace the item named "mainpage", is taken from MediaWiki:Mainpage. To set/change this text for users, who display your wiki in German, you can put the according text on the page MediaWiki:Mainpage/de.

That way you can easily translate these texts through the MediaWiki interface.

For more advanced translation, see Help:Extension:Translate/Unstructured element translation.

高度なカスタマイズ
The sidebar can be fully customized by implementing JavaScript or Cascading Style Sheets, or by editing the PHP files directly. Before using these methods, note that:
 * JavaScript is fragile: it will not work for users with JavaScript disabled, and scripts frequently fail in different browsers or skins.
 * Editing the PHP files can easily cause unexpected errors, and your changes will be lost in the next update unless you manually change the new files.

Force UI-messages to follow content
Some pages should sometimes follow the content language, especially for multilingual sites. This can be controlled with the setting $wgForceUIMsgAsContentMsg. Each message overridden in this way must be explicitly given, for example to let the sidebar link to versions given by the content language for the main page and the portal page add the following to
 * コード

節の追加や削除 (JavaScript)
The toolbox, which appears under the search bar, is a dynamic element and cannot be easily customized without the use of skinning extensions (otherwise it requires programming in PHP.) If you still want to do so, you can copy, creating a new skin. You can then make a custom skin to generate these links in your preferred fashion.

Another JavaScript solution is below.

For this solution to work on the entire MediaWiki site, this script has to be copied to MediaWiki:Common.js (MediaWiki:Common.js is available for MediaWiki 1.9 +).

For this solution to work only for a specific user, add this script to Special:MyPage/monobook.js (or another JS page, depending on your preferred skin).

Now simply configure which link should appear in which section. You also can remove some links if you want to.


 * コード


 * Usage
 * function CustomizeModificationsOfSidebar has to be customized for adding or removing links in specific sections:


 * ModifySidebar( "action", "section", "name", "link" );

If you want to restrict the modification of the links to a specific user group (e.g. bureaucrat), change to and add
 * restricting modifications to specific usergroups

For restricting the modifications to IPs instead of a specific user group, use

Make expanding/collapsing sidebar for all users (Monobook skin only)
If you use the Monobook skin and don't want to miss the expandable menu bar from e.g. Vector skin, paste the following code into MediaWiki:Monobook.js of your wiki.

モノブックスキンでのサイドバーの幅 (CSS)
You can change the width of your sidebar by adding the following CSS rules to your MediaWiki:Monobook.css, note that this is an article, not a file. This changes the width to 15em, the actions position and portlet width should be an em or so less, so I've set them to 14em in this example.

ベクタースキンでのサイドバーの幅 (CSS)
You can change the width of your sidebar by adding the following CSS rules to your MediaWiki:Vector.css. The standard width in vector skin is 10em. The following example changes the width to 12em:

ログイン時にサイドバーの内容を変更 (PHP)
You can modify the sidebar using a hook. Create a small extension of your own or put the code directly into your LocalSettings.php file.

Some example code adding a 'navigation' sidebar block with a login link for logged out users.

サイドバー内でのパーサー関数の使用
Although its not exactly recommended, the sidebar does support parser functions (such as ParserFunctions), provided the ** is outside the parser function, and the parser function does not span multiple lines. For example:
 * Heading

works. However the following would not work since the parser function spans multiple lines:
 * Heading

変更がすぐに反映されない
MediaWikiは、変更後にナビゲーションバーが反映されないということをしばしば引き起こす、いろいろなレベルで積極的なキャッシングを行なっている. キャッシュのパージに影響されるページはこの状況を修正すべきである. 一回ですべてのキャッシュの大量のパージを実行するために、データベース中で、truncateをobjectcacheテーブルに対して行なうか、LocalSettings.phpファイル内でtouchする(両方してもよい).

You also need to have $wgUseDatabaseMessages set to true.

小文字のリンクラベル
If your links are not being capitalized as intended, たとえば以下のようにバー文字の前後に空白を挿入する. 例: ** http://www.example.com/download.php?file=44555 | Download

Sections disappear or show unexpected content
If a section does not display or displays unexpected content, check that the header text isn't the name of an interface message by searching Special:AllMessages. If it is, use a different header text, or create a new interface message and use it.

For example, if you want to use "Sidebar" as header text, create the interface message "MediaWiki:Sidebar-header" containing only "Sidebar". Then, use  as header.

Sections are not displayed if there are no links of the form  (e.g. when the target was forgotten).

Special:Version の更新後にリンク切れが発生
This will happen e.g., each time there are newer translations for your site language's sidebar items. One could add new redirect pages each time, but a better solution would be to use one's own sidebar item names instead of trying to keep track of the current MediaWiki translations.

MediaWiki の過去のバージョン
If you have a pre-release version of 1.5 Beta, or earlier, it is still possible in some cases to edit the sidebar:
 * Prior to 1.5 branching (between 9150 and 9177) the message utilized was briefly MediaWiki:Navbar.
 * Before this, version 1.4 had (from 5528 to 9150) a global variable, titled $wgNavigationLinks.

関連項目

 * Sidebar
 * Extension:SideBarMenu
 * Quickbar
 * w:User:Mike Dillon/Sidebar
 * Extension:CustomSidebar
 * User:Goldbishop/Sidebar (updated for MW 1.19)
 * Manual:Interface/Sidebar/Hacks - Unsupported PHP modifying hacks that used to be on this page
 * Manual:$wgEnableSidebarCache
 * Category:Menu extensions/ja