Extension:Header Tabs

This page is a translated version of the page Extension:Header Tabs and the translation is 71% complete.
Other languages:
English • ‎polski • ‎日本語 • ‎한국어
MediaWiki 拡張機能マニュアル
OOjs UI icon advanced.svg
Header Tabs
リリースの状態: 安定
実装 パーサー関数 , ユーザー インターフェイス
説明 Displays top-level headers as JavaScript-based tabs
最新バージョン 2.0 (2020年8月)
互換性ポリシー Master maintains backwards compatibility.
MediaWiki 1.33+
ライセンス GNU 一般公衆利用許諾書 2.0 以降
Version history
Wiki of the Month on semantic-mediawiki.org
  • $wgHeaderTabsRenderSingleTab
  • $wgHeaderTabsDisableDefaultToc
  • $wgHeaderTabsAutomaticNamespaces
  • $wgHeaderTabsEditTabLink
  • $wgHeaderTabsGenerateTabTocs
  • $wgHeaderTabsDefaultFirstTab
  • $wgHeaderTabsUseHistory
translatewiki.net で翻訳を利用できる場合は、Header Tabs 拡張機能の翻訳にご協力ください

使用状況とバージョン マトリクスを確認してください。

The Header Tabs extension transforms top-level MediaWiki headers into JavaScript-based tabs.


To enable tabs on a page after you installed the extension, you need to add a <headertabs /> tag into the page in place where the last tab should end (everything below this tag will be shown under the tab view). Most of the time, though, you'll want to put it at the bottom of the page.

In addition to that, the page should have top-level headers defined in it like this:

= 見出し =

Each such top-level header, if it's anywhere above the <headertabs /> tag, will be displayed as a tab.

Linking to tabs

You can link to a tab, both from another page and from within that same page (and, within that same page, both from another tab and from outside the tab view). This is done using the {{#switchtablink}} parser function, which is called like this:

{{#switchtablink:タブ名|リンク テキスト|ページ名}}

This will create a link to the tab with the name "Tab name", and the text of the link will read "Link text". If you want the link to a point to a tab on another page, you can optionally add the third parameter, "Page name".

Multibyte characters was well as formatting characters e.g. bold is not permitted if you want to link to tabs in any way.


= 最初の節見出し =


= 2番めの節見出し =

= 3番目の節見出し =
これは <headertabs/> タグの下にあるため、常にタブ表示の下に表示されます。



Header Tabs のコードは .zip 形式でダウンロードできます: https://github.com/wikimedia/mediawiki-extensions-HeaderTabs/archive/2.0.zip

You can also download the code directly via Git from the MediaWiki source code repository. From a command line, call the following:

git clone https://phabricator.wikimedia.org/diffusion/EHET/extension-headertabs.git

各ファイルのバージョン履歴を含むコードをオンラインで閲覧するにはこちら: https://phabricator.wikimedia.org/diffusion/EHET/browse/master/


  • ダウンロードして、ファイルを extensions/ フォルダー内の HeaderTabs という名前のディレクトリ内に配置します。
  • 以下のコードを LocalSettings.php の末尾に追加します:
    wfLoadExtension( 'HeaderTabs' );
  •   完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。


Skin modification

To change the tabs' styling, see "Skin modification".


The following parameters can be modified in LocalSettings.php below the call to wfLoadExtension().


$wgHeaderTabsUseHistory defines whether tab navigation should be tracked within the browser history and within the URL, updating the hash value. By default this variable is set to true, i.e. history is used. You can disable it by adding the following:

$wgHeaderTabsUseHistory = false;


The $wgHeaderTabsRenderSingleTab variable defines if Header Tabs will activate if only a single top-level header is found. By default this variable is set to false, i.e. no tabs will be shown if only one top-level header is found. You can enable this behaviour by adding the following:

$wgHeaderTabsRenderSingleTab = true;


The $wgHeaderTabsAutomaticNamespaces variable defines the set of namespaces for which you don't need to add the <headertabs /> tag in order to enable tabs. If a namespace ID is defined in this variable, header tabs will activate automatically when you have two top-level headers (or one, if you have $wgHeaderTabsRenderSingleTab set to true) in an article. By default this variable holds no namespaces. You can add namespaces to this list by adding the following for each namespace:

$wgHeaderTabsAutomaticNamespaces[] = NS_MAIN;


The $wgHeaderTabsDefaultFirstTab variable defines whether Header Tabs puts any content before the first defined header and put it into its own tab. By default this variable is set to false. You can enable this behavior by adding the default name using the following:

$wgHeaderTabsDefaultFirstTab = 'DefaultTabName';

If using this setting, be careful not to enable $wgHeaderTabsRenderSingleTab as it will lead to tabs appearing in other parts of the UI.


The $wgHeaderTabsDisableDefaultToc variable defines whether Header Tabs will disable the MediaWiki article's table of contents (TOC) when tabs are enabled for a given article. This saves you the trouble of having to add __NOTOC__ to your article. If tabs are not enabled because of a lack of top-level headers, the table of contents will appear as usual. By default this variable is set to true, i.e. the MediaWiki TOC is disabled if header tabs are shown. You can disable this behavior by adding the following:

$wgHeaderTabsDisableDefaultToc = false;


The $wgHeaderTabsGenerateTabTocs variable defines if Header Tabs will try to generate a TOC for each tab. By default this variable is set to false, i.e. no tab TOCs will be generated. You can enable this behavior by adding the following:

$wgHeaderTabsGenerateTabTocs = true;


The $wgHeaderTabsEditTabLink variable defines if Header Tabs will add a edit link to the right of the tabs which let you edit only the tabs' text. By default this variable is set to true, i.e. a edit link for the tab will be shown. You can disable this behavior by adding the following:

$wgHeaderTabsEditTabLink = false;


To see a list of changes for each version, see version history. For a list of features planned for future releases, please see roadmap.


  • You cannot use the tag more than once. In other words, a second tag will not produce a second series of tabs.
  • Tabs render on top of infoboxes in Chrome.
  • Header Tabs will not work with the HTML Tidy tool, i.e. if $wgTidyConfig is populated.

Incompatible extensions and skins

For versions earlier than 2.0, Header Tabs does not render correctly when used alongside the following skins and extensions:

  • MathJax - when the two are used together, it leads to faulty HTML, which results in a broken display in at least the Firefox web browser.

(Things might have changed as MathJax has been updated.) You can disable MathJax on specific pages by adding __NOMATHJAX__.

  • AddThis (or the Widget) - only the first tab is shown
  • MobileFrontend- same as AddThis.
  • SectionHide - incompatible due to both extensions altering section behavior. SectionHide now includes an automatic check that will inform the user that the extension does not work with Header Tabs.
  • Echo - seems to cause display problems with Header Tabs.
  • Tweeki - Skin Tweeki breaks the layout and hide the text of the tabs

There are no known issues, however, for Header Tabs 2.0 and higher, after Header Tabs switched to using the OOUI JavaScript library.

Sections appearing outside the tabbed section

Header Tabs sections which include floated objects (such as infoboxes) may appear outside the tabs container if other content does not force the container to be large enough to hold the floated object. One resolution to this problem is to place a cleared html element at the very end of each section.

A simple, but not best-practice, means of doing this is:

<div style="clear:both"></div>

This forces this element to be considered by the browser after your floated object and thus will grow the container to fit both.


The best way to seek help with this extension is to send questions to the mediawiki-l mailing list. The extension maintainers, and active users and contributors, are on this list and will be able to help you.