Help:How to create a navigation box

From Hitchwiki
Jump to navigation Jump to search


This is a little guide on how to create little navigation boxes, like for summarizing regions or cities of a country. For example, have a look at Template:Regions England, and it's use for example at the South East England article. Or the Germany article currently lists all cities with more than 100.000 inhabitants in a navigation box. An example of a navigation box is shown below:


Well, that's simple. Imagine you want to create a little navigation box for every article for all 50 states of the US. Instead of writing a new box on each article, you can create a template. This templates can be simply added by typing {{name template}} in an article. So you create one model, and then easily adding to all your regions or wherever you want to by simply using the code described above. That's saving much working time! And if something changes (like new regions are created), you just can edit the template, and the effect will occur on all other articles including this template immediately. But how to create such a box?

How to create?

  • First, you have to think where you want to make a navigation box for. Maybe your country needs a little navigation box for it's regions? So, let's take for example England. When there are so much articles about little villages of a country, they could be better summarized on a specific region article, like the South East in England.
  • Second step is to make some research. Look into your brain if you know them all, or have a look at wikipedia or ask google or your local expert of geography to gather the information you need.
  • Third, you can begin creating a template on the hitchwiki. Type the name of the template you want to create into the search box to your left. For example for England, type in Template:Regions England or Template:Regions Belgium or whatever. It is important to begin all templates with naming them Template:. Otherwise you are creating a special article for Regions England. If this Template occurs as not existing, you can click on create a new article. You find an empty edit-box where you can type in text, like when you add things to existing articles. But ha, it's empty. Best is to copy & paste the following source code to the edit box to create an empty navigation box.

 {| class="toccolours" align="center" style="margin: 0 2em; clear: both;"
 !style="background:#ccccff" width="94%"| Regions of [[Country X]]
 |align="center" style="font-size: 90%;" colspan="2"|
 '''Provinces:''' [[Region 1]] | [[Region 2]] | ...

If you now press the Preview Button next the Save Page button, you see a preview of the navigation box. Of course it still occurs empty. Now you can begin filling in the box with information.

For adding the name of the country, replace [[Country X]] with the name of the country. Do not clear the brackets [[ ]]. After that, you can fill in the names of the regions or cities you want to add by typing in information at [[Region 1]] | [[Region 2]] etc. Just add as much regions as there are. If you want to create a new line, just do it like this:

|align="center" style="font-size: 90%;" colspan="2"|
'''Provinces:''' [[Region 1]] | [[Region 2]] | ...

'''Cities:''' [[City 1]] | [[City 2]] | ...

So easily just add an extra blank line. Easy, isn't it? If you're not sure what you are doing, just try it out and press the Preview button. If it doesn't fit, just change it again.

That was it, you just created your own navigation box ! Congratulations!

How to add the box to the articles?

If you saved your navigation box correctly, visit the article page you want to add the box to. Click the edit button on the top of the article, scroll down in the text until the point where you want to add your box, and simply type in {{regions x}}. Then the box should occur currently. For example, if you called your template Template:Regions Belgium, you have to type in {{regions belgium}}to let the template occur on your article. You don't need to write the Template:' there.

Further stuff

If you want, you can fix the alignment of the box as you want. At the beginning of the box, you find this line:

| class="toccolours" align="center" style="margin: 0 2em; clear: both;"

By changing, for example, the align="center" into align="left", your box now will occur on the left side of the article. You can also add some style stuff to the box, but this is more recommended for people who are experts in html and all this stuff.