From OpenStreetMap Wiki
Jump to navigation Jump to search

This is a template to allow users to easily add a set of tabs at the top of a page to switch between different pages. It is based on the code used on DE:JOSM/Anleitung converted to template form for easy inclusion on other pages.

The template can support up to 6 tabs - the actual number depends on the number of tabs defined in the parameters for the template. Whilst the template can allow for upto 6 tabs you should aim to use as few tabs as possible and to have as short as possible text on each tab to ensure that the tabs fit across the page on smaller monitors. Each tab is allocated the same width; if this width is too narrow for the text the text will wrap within the tab.


Parameter name Required Purpose
tab1 No The text for tab 1. If tab1 is not supplied then tab number 1 will not be displayed
tab1link No The target page. The default is to use the tab1 value
tab2 No The text for tab 2. If tab2 is not supplied then tab number 2 will not be displayed
tab3 No The text for tab 3. If tab3 is not supplied then tab number 3 will not be displayed
tab4 No The text for tab 4. If tab4 is not supplied then tab number 4 will not be displayed
tab5 No The text for tab 5. If tab5 is not supplied then tab number 5 will not be displayed
tab6 No The text for tab 6. If tab6 is not supplied then tab number 6 will not be displayed
selected Yes The selected tab. May be either an integer which then selects the appropriate tab or a text value in which case it selects the tab showing the text. Using a text value may be easier as it allows swapping the order of tabs without having to update the selected number for each page.


{{Tabs |tab1=A |tab1link=London |tab2=B |tab3=C |tab4=D |tab5=E |selected=5}}

This creates 5 tabs. The 5th tab will be selected. The first tab will be labeled A and will contain a link to London. The second tab will be labeled B and contain a link to B.

Using the template

You will need to repeat the tabs template at the top of each page which is accessed using the tabs.

This can make maintenance a burden. Instead it may be easier to create a second template which accesses this template and supplies all the necessary titles in one go. For example you could create a template called JSOMTabs with the following content:

{{Tabs |tab1=Introduction |tab1link=JSOM |tab2=Plugins |tab2link=JSOM/Plugins |tab3=FAQs |tab3link=JSOM/FAQs |selected={{{selected}}}}}

This will create a template that adds 3 tabs to the page with defined headings. To use the template simply include {{JSOMTabs|selected=xxx}} on each page you want the tabs to appear on.


  Introduction    Plugins    FAQs  

this page is for ...