|- class="vcard" ! style="background-color: {{Template:{{{party}}}/meta/color}}; width: 5px;" | | class="org" style="width: 130px" | [[{{{party}}}|{{Template:{{{party}}}/meta/shortname}}]] | class="fn" | {{{candidate}}} | style="text-align: right; margin-right: 0.5em" | {{{votes}}} | style="text-align: right; margin-right: 0.5em" | {{{percentage}}} | style="text-align: right; margin-right: 0.5em" | {{{change}}}
|-
A more sophisticated effect can be achieved using Template:Election box candidate with party link. This adds a link to the candidate's party and also adds a color tab to the left of the candidate. For example:
For example:
{{Election box begin | title=[[United Kingdom general election, 2005|General Election 2005]]: Strangford}} {{Election box candidate with party link| |party = Labour Party (UK) |candidate = Tony Blair |votes = 9,999 |percentage = 50.0 |change = +10.0 }} {{Election box candidate with party link| |party = Conservative Party (UK) |candidate = Michael Howard |votes = 9,999 |percentage = 50.0 |change = +10.0 }} {{Election box end}}
Will create this:
General Election 2005: Strangford | |||||
---|---|---|---|---|---|
Plaid | Ymgeisydd | Pleidleisiau | % | ±% | |
Llafur | Tony Blair | 9,999 | 50.0 | +10.0 | |
Ceidwadwyr | Michael Howard | 9,999 | 50.0 | +10.0 |
However, this does rely on some additional setup for each party. See below for more details.
It is necessary to do some a little bit of setup for each party in the election. This involves creating two simple templates for the article that you will be linking to (eg Labour Party (UK)). These contain the identifying color of the party and the short name that will be used as the link caption (as the full wikipedia page name will probably not be suitable).
The two templates that you will need to create are:
The color template will just contain the party's identifying color (eg red), and the shortname template will just contain the name of the party as you want it to appear on the link (eg Labour).
You should also add something to the main article's talk page to indicate that these two templates exist. There is a template Template:Election box metadata that can be used to do this.
Following are some easy step-by-step instructions for adding the two sub-pages:
ArticleName/meta/color
. As this page does not yet exist, this will take you directly to the page creation screen.ArticleName/meta/shortname
sub-page.The HTML markup produced by this template includes an hCard microformat, which makes the person's details parsable by computers, either acting automatically to catalogue articles across Wikipedia or via a browser tool operated by a reader, to (for example) add the subject to an address book or database. For more information about the use of microformats on Wikipedia, please see the microformat project.
Date-of-birth ("bday") information will only be included in the microformat if {{Birth date}}, {{Birth date and age}}, {{Birth-date}} ({{bday}}), or {{Birth-date and age}} ({{b-da}}) are used in the infobox. (but do not use these if the date is before 1583).
To include a URL, use {{URL}}.
Please do not remove instances of these sub-templates.
Please do not rename or remove these classes; nor collapse nested elements which use them.{{#ifeq: Election box candidate with party link|doc||{{#ifeq: Election box candidate with party link|sandbox|| </noinclude>
Mae'r ddogfennaeth uchod wedi ei thrawsgynnwys o Nodyn:Election box candidate with party link/doc. (golygu | hanes) Gall golygyddion arbrofi yn y tudalennau pwll tywod (creu | drych) a testcases (creu). Os gwelwch yn dda, ychwanegwch gategorïau a rhyngwicis at yr is-dudalen /doc. Is-dudalennau'r nodyn hwn. |