How to Create a Navbox: Difference between revisions

From FamilySearch Wiki
mNo edit summary
Line 10: Line 10:
*It is recommended that you create infobox tables in HTML as there fewer problems as you will see.
*It is recommended that you create infobox tables in HTML as there fewer problems as you will see.
*We will be creating a navbox as shown below.  
*We will be creating a navbox as shown below.  
{{User:ccsmith/sandbox/navbox1
|name=
<!----select colors for background of box, title, right and left columns------------>
|navbox background color=#ffffff
|title background color=#fcca2a
|left column background color=#fff75e
|right column background color=#fffba4
<!----Group titles can be Topics, Counties, Migration Routes, anything that is a list of items to be posted in the navbox---------------------->
<!----if you need more items in a group, copy and paste a line and then put the correct sequential number after the word "item" for additional items added---->
<!----in addition you need to add more items you need to the navbox template to add more lines.  go to User:Ccsmith/sandbox/navbox1 for instructions---->
|group title1=
|group title1-item1=
|group title1-item2=
|group title1-item3=
|group title1-item5=
|group title1-item6=
|group title1-item7=
|group title1-item8=
|group title1-item9=
|group title1-item10=
|group title1-item11=
|group title1-item12=
|group title1-item13=
|group title1-item14=
|group title1-item15=
|group title1-item16=
|group title1-item17=
|group title1-item18=
|group title1-item19=
|group title1-item20=
<!----to add more title-items copy and past one of the group title-item lines and add the correct numbers---->
<!----second row with subject of line and links for the subject---------------------->
|group title2=
|group title2-item1=
|group title2-item2=
|group title2-item3=
|group title2-item4=
|group title2-item5=
|group title2-item6=
|group title2-item7=
|group title2-item8=
|group title2-item9=
|group title2-item10=
|group title2-item11=
|group title2-item12=
|group title2-item13=
|group title2-item14=
|group title2-item15=
|group title2-item16=
|group title2-item17=
|group title2-item18=
|group title2-item19=
|group title2-item20=
<!----to add more title-items copy and past one of the group title-item lines and add the correct numbers---->
<!----thrid row with subject of line and links for the subject---------------------->
|group title3=
|group title3-item1=
|group title3-item2=
|group title3-item3=
|group title3-item4=
|group title3-item5=
|group title3-item6=
|group title3-item7=
|group title3-item8=
|group title3-item9=
|group title3-item10=
|group title3-item11=
|group title3-item12=
|group title3-item13=
|group title3-item14=
|group title3-item15=
|group title3-item16=
|group title3-item17=
|group title3-item18=
|group title3-item19=
|group title3-item20=
<!----to add more title-items copy and past one of the group title-item lines and add the correct numbers---->
<!----fourth row with subject of line and links for the subject---------------------->
|group title4=
|group title4-item1=
|group title4-item2=
|group title4-item3=
|group title4-item4=
|group title4-item5=
|group title4-item6=
|group title4-item7=
|group title4-item8=
|group title4-item9=
|group title4-item10=
|group title4-item11=
|group title4-item12=
|group title4-item13=
|group title4-item14=
|group title4-item15=
|group title4-item16=
|group title4-item17=
|group title4-item18=
|group title4-item19=
|group title4-item20=
<!----to add more title-items copy and past one of the group title-item lines and add the correct numbers---->
<!----fifth row with subject of line and links for the subject---------------------->
|group title5=
|group title5-item1=
|group title5-item2=
|group title5-item3=
|group title5-item4=
|group title5-item5=
|group title5-item6=
|group title5-item7=
|group title5-item8=
|group title5-item9=
|group title5-item10=
|group title5-item11=
|group title5-item12=
|group title5-item13=
|group title5-item14=
|group title5-item15=
|group title5-item16=
|group title5-item17=
|group title5-item18=
|group title5-item19=
|group title5-item20=
<!----to add more title-items copy and past one of the group title-item lines and add the correct numbers---->
<!----If you need more group titles and items, just copy and paste another set of group title and group title-items----->
}}
*Here is the coding in HTML and Wikitext for the above Navbox:
<table style="border:1px solid black; width:100%; ">
<table style="border:1px solid black; width:100%; ">
<tr>
<tr>
<td style="width:50%; border:1px solid black; ">
<td style="text-align:center; font-size:16pt; color:blue; width:50%; ">Wikitext</td>
<td style="text-align:center; font-size:16pt; color:blue; width:50%; ">HTML</td>
</tr>
<tr>
<td style="border:1px solid black; ">
<nowiki>{| style="width:100%; border:1px solid blue; background-color:{{{navbox background color}}}; border-collaspe:separate; border-spacing:5px; "></nowiki><br>
<nowiki>{| style="width:100%; border:1px solid blue; background-color:{{{navbox background color}}}; border-collaspe:separate; border-spacing:5px; "></nowiki><br>
<nowiki>{{!}}-</nowiki><br>
<nowiki>{{!}}-</nowiki><br>
Line 24: Line 160:
<nowiki>|}</nowiki><br>
<nowiki>|}</nowiki><br>
</td>
</td>
<td style="width:50%; border:1px solid black; ">
<td style="border:1px solid black; ">
<nowiki><table style="width:100%; border:1px solid blue; background-color:{{{navbox background color}}}; border-collaspe:separate; border-spacing:5px; "></nowiki><br>
<nowiki><table style="width:100%; border:1px solid blue; background-color:{{{navbox background color}}}; border-collaspe:separate; border-spacing:5px; "></nowiki><br>
<nowiki><tr></nowiki><br>
<nowiki><tr></nowiki><br>

Revision as of 08:35, 3 October 2014

This page is under going major revision

What are Navboxes?[edit | edit source]

Navboxes are nothing more than a table saved as a template. Navboxes are usually at the bottom of the article and usually only contain links to topics or locations. See the example at the bottom of this article.

How to create a Navbox[edit | edit source]

Again an Navbox is a table. If you know how to create tables in Wikitext or HTML, it is not difficult. If you do not know Wikitext or HTLM, you will probably need someone who does to help you. If you would like to learn these two programs, see Wikitext or HTML Programming. Neither of these programming languages are difficult.

Step One - Create the table[edit | edit source]

  • We are going to assume you know a little Wikitext and HTML in this tutorial. We will begin by creating a simple table. The coding will be displayed in both Wikitext and HTML side by side so can see the difference.
  • Since navboxes usually extend from one side to the other, we have set the width for our navbox to 100%.
  • It is recommended that you create infobox tables in HTML as there fewer problems as you will see.
  • We will be creating a navbox as shown below.

User:Ccsmith/sandbox/navbox1

  • Here is the coding in HTML and Wikitext for the above Navbox:
Wikitext HTML

{| style="width:100%; border:1px solid blue; background-color:{{{navbox background color}}}; border-collaspe:separate; border-spacing:5px; ">
{{!}}-
{{!}} colspan="2" style="text-align:center; background-color:{{{title background color}}}; ">Links to {{{name}}} - related articles


{{!}}-
{{#if:{{Ifempty|{{{group title1|}}}}}|
{{!}} style="text-align:right; width:15%; background-color:{{{left column background color}}}; ">'''{{{group title1}}}'''|}}

{{#if:{{Ifempty|{{{group title1-item1|}}}}}|
{{!}} style="text-align:left; background-color:{{{right column background color}}}; "> {{#if:{{{group title1-item1|}}}|{{{group title1-item1}}}{{·}}|}} {{#if:{{{group title1-item2|}}}|{{{group title1-item2}}}{{·}}|}} {{#if:{{{group title1-item3|}}}{{·}}|{{{group title1-item3}}}{{·}}|}} {{#if:{{{group title1-item4|}}}|{{{group title1-item4}}}{{·}}|}} {{#if:{{{group title1-item5|}}}|{{{group title1-item5}}}{{·}}|}}|}}

|}

<table style="width:100%; border:1px solid blue; background-color:{{{navbox background color}}}; border-collaspe:separate; border-spacing:5px; ">
<tr>
<td colspan="2" style="text-align:center; background-color:{{{title background color}}}; ">Links to {{{name}}} - related articles
</td>
</tr>
<tr>
{{#if:{{Ifempty|{{{group title1|}}}}}|
<td style="text-align:right; width:15%; background-color:{{{left column background color}}}; ">'''{{{group title1}}}'''|}}
</td>
{{#if:{{Ifempty|{{{group title1-item1|}}}}}|
<td style="text-align:left; background-color:{{{right column background color}}}; "> {{#if:{{{group title1-item1|}}}|{{{group title1-item1}}}{{·}}|}} {{#if:{{{group title1-item2|}}}|{{{group title1-item2}}}{{·}}|}} {{#if:{{{group title1-item3|}}}{{·}}|{{{group title1-item3}}}{{·}}|}} {{#if:{{{group title1-item4|}}}|{{{group title1-item4}}}{{·}}|}} {{#if:{{{group title1-item5|}}}|{{{group title1-item5}}}{{·}}|}}|}}</td>
</tr>
</table>

  • Now pay close attention to the table tags. You should notice this coding: class="infobox" in the table tag . This code tells the browser that a infobox is being created and to place it on the right hand side of the article.
  • Since the name of the organization and the image will extend over the two columns which contain the information about the organization we will install colspan="2" in the organization and image coding.
  • When you save your infobox be sure include the word "infobox" in the title so people will know what kind of template it is for example: {{template:infobox sample}}.

Step Two - Create the template[edit | edit source]

User:Ccsmith/sandbox/navbox

Wikitext HTML

{{Navbox name
|group title
|item1
|item2
|item3
|item4
|item5
}}

{{Navbox name
|group title
|item1
|item2
|item3
|item4
|item5
}}