Join the Fediverse:Template guide: Difference between revisions

From Join the Fediverse
m (Text replacement - "The climate justice movement in the Fediverse" to "{{Internal link |target=Climate justice in the Fediverse}}")
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Internal page with issues |text=Paula will finish this page later. Please don't edit until this message is removed to avoid simultaneous edits.}}
This page is supposed to explain to editors what templates are, how to use them and how to edit them.<br>
This page is supposed to explain to editors what templates are, how to use them and how to edit them.<br>
Not all templates will be explained here, but you should get a general idea about how they work and then be able to use the others as well. You can find all templates in [[:Category:Templates]] and sub-categories.
Not all templates will be explained here, but you should get a general idea about how they work and then be able to use the others as well. You can find all templates in [[:Category:Templates]] and sub-categories.
Line 8: Line 7:


Templates are generally just any content that is put into a page in the template namespace (pages that start with Template:) and can be used in any other page by simply writing the page name of the template in double braces.<br>
Templates are generally just any content that is put into a page in the template namespace (pages that start with Template:) and can be used in any other page by simply writing the page name of the template in double braces.<br>
So e.g. if you have a page called Template:Hello with the content "Hello world!" and you write <nowiki>{{Hello}}</nowiki> in any article then that will be displayed as "Hello world!".<br>
So e.g. if you have a page called Template:Hello with the content "Hello world!" and you write {{ic|<nowiki>{{Hello}}</nowiki>}} in any article then that will be displayed as "Hello world!".<br>
Of course templates are rather used for more complicated things than just a short piece of text. See examples below.
Of course templates are rather used for more complicated things than just a short piece of text. See examples below.


Line 16: Line 15:
* The template displays at all and not just as "Template:Example" in red text
* The template displays at all and not just as "Template:Example" in red text
* There are no broken links or images in the template
* There are no broken links or images in the template
* There are o missing parameters that display e.g. as <nowiki>{{{parameter}}}</nowiki>
* There are o missing parameters that display e.g. as {{ic|<nowiki>{{{parameter}}}</nowiki>}}
* The template is in the right position
* The template is in the right position
* Ideally: There are no redundant line breaks
* Ideally: There are no redundant line breaks
Line 25: Line 24:
Anyway you'll then usually get a popup asking you for some parameters. Some of them have to be filled, others are optional. On the left side you'll be able to add more parameters that are available, but might not usually be needed.<br>
Anyway you'll then usually get a popup asking you for some parameters. Some of them have to be filled, others are optional. On the left side you'll be able to add more parameters that are available, but might not usually be needed.<br>
This depends on the template having template data defined, which not all have (yet).<br>
This depends on the template having template data defined, which not all have (yet).<br>
There are also very simple templates like <nowiki>{{Mastodon}}</nowiki> which will never get template data, because they don't have parameters and can only generate one result. In this case that is:
There are also very simple templates like {{ic|<nowiki>{{Mastodon}}</nowiki>}} which will never get template data, because they don't have parameters and can only generate one result. In this case that is:
{|class="wikitable"
{|class="wikitable"
|{{Mastodon}}
|{{Mastodon}}
Line 32: Line 31:
===With the source editor===
===With the source editor===


If you use the source editor you have to type in the name of the template in the correct capitalization within double braces. So e.g. <nowiki>{{Mastodon}}</nowiki> for the example above.<br>
If you use the source editor you have to type in the name of the template in the correct capitalization within double braces. So e.g. {{ic|<nowiki>{{Mastodon}}</nowiki>}} for the example above.<br>
If the template uses parameters you have to write them in the braces as well like this: <nowiki>{{Template name |parameter 1=example |parameter 2=example 2}}</nowiki>.
If the template uses parameters you have to write them in the braces as well like this: {{ic|<nowiki>{{Template name |parameter 1=example |parameter 2=example 2}}</nowiki>}}.


==Examples==
==Examples==
Line 39: Line 38:
Here's a list of some templates and how to use them.
Here's a list of some templates and how to use them.


===Important basic templates===
===Basic templates===
 
See [[:Category:Basic templates]]


We do some things differently in this wiki than elsewhere, because we use the translate extension and not have different wikis in every language (like Wikipedia).<br>
We do some things differently in this wiki than elsewhere, because we use the translate extension and not have different wikis in every language (like Wikipedia).<br>
Line 46: Line 47:
====Internal links====
====Internal links====


For internal links, instead of e.g. <nowiki>[[Main Page]]</nowiki> to link to the [[Main Page]] we use <nowiki>{{Internal Link |target=Main Page |link-name=Main Page}}</nowiki>.
For internal links, instead of e.g. {{ic|<nowiki>[[Main Page]]</nowiki>}} to link to the [[Main Page]] we use {{ic|<nowiki>{{Internal link |target=Main Page |link-name=Main Page}}</nowiki>}}.


====Categories====
====Categories====


Instead of <nowiki>[[Category:Category name]]</nowiki> to add a category to a page we use <nowiki>{{category |category=Category name}}</nowiki>.
Instead of {{ic|<nowiki>[[Category:Category name]]</nowiki>}} to add a category to a page we use {{ic|<nowiki>{{category |category=Category name}}</nowiki>}}.
 
====Code====
 
To put some code inside a grey box like {{Ic|example code}} just write <nowiki>{{Ic|example code}}</nowiki>.
 
====Warning small====
 
To make a {{Warning small|harsh warning}} just write {{Ic|<nowiki>{{Warning small|harsh warning}}</nowiki>}}. In this case {{Ic|harsh warning}} is a custom text, by default {{Ic|<nowiki>{{Warning small}}</nowiki>}} just puts out {{Warning small}}.
 
====Navbar====
 
Many pages display a navbar on the bottom, but not in mobile view. To add this to the page just put {{Ic|<nowiki>{{Navbar}}</nowiki>}} on the bottom of the page. If it's a page about a software project, e.g. Mastodon, then use e.g. {{Ic|<nowiki>{{Navbar/Mastodon}}</nowiki>}} instead.
 
====Language switch====
 
This one is rarely needed for basic editing. It simply puts a slash followed by the language code in the text. So e.g. /en, /de, /ja, /he, ...<br>
To use it simply put {{Ic|<nowiki>{{Language switch}}</nowiki>}} in the code.
 
===Content templates===
 
See [[:Category:Content templates]].<br>
These are templates that are simply used to put something in many articles without having to edit each article every time the content updates.
 
They are:
* [[Template:Comparison of Mastodon forks]]
* [[Template:Comparison of microblogging services]]
* [[Template:Getting started links]]


===Infobox templates===
===Infobox templates===
Line 62: Line 90:
!How to use it
!How to use it
|-
|-
|<nowiki>{{Infobox}}</nowiki>
|{{ic|<nowiki>{{Infobox}}</nowiki>}}
|For use in [[:Category:What are Fediverse projects?]] articles.
|For use in [[:Category:Fediverse projects]] articles.
|Put it on top of the article, or if there are already <nowiki><translate></nowiki> tags then put it right below <nowiki><languages/><translate></nowiki>. Write the first paragraph of the article right below the template - no line breaks.
|Put it on top of the article, or if there are already {{ic|<nowiki><translate></nowiki>}} tags then put it right below {{ic|<nowiki><languages/><translate></nowiki>}}. Write the first paragraph of the article right below the template - no line breaks.
|-
|-
|<nowiki>{{Infobox defunct}}</nowiki>
|{{ic|<nowiki>{{Infobox discontinued}}</nowiki>}}
|Same, but for Fediverse projects that are no longer maintained.
|Same, but for Fediverse projects that are no longer maintained.
|Same.
|Same.
|-
|-
|<nowiki>{{Infobox App}}</nowiki>
|{{ic|<nowiki>{{Infobox app}}</nowiki>}}
|Use in [[:Category:Apps]] articles.
|Use in [[:Category:Apps]] articles.
|Same as above: On the very top of the article except articles with translate tags.
|Same as above: On the very top of the article except articles with translate tags.
|-
|-
|<nowiki>{{Infobox App short}}</nowiki>
|{{ic|<nowiki>{{Infobox app short}}</nowiki>}}
|Same, if there are no media files for the app uploaded yet.
|Same, if there are no media files for the app uploaded yet.
|Same.
|Same.
|-
|-
|<nowiki>{{Infobox instance}}</nowiki>
|{{ic|<nowiki>{{Infobox book}}</nowiki>}}
|Infobox about books by fedizens.
|Same.
|-
|{{ic|<nowiki>{{Infobox instance}}</nowiki>}}
|Use on an instance's own page in the Instance: namespace and on the [[Instances]] page.
|Use on an instance's own page in the Instance: namespace and on the [[Instances]] page.
|On the instance's page put it on top, on the [[Instances]] page put it at the place where the instance you want to add classifies.
|On the instance's page put it on top, on the [[Instances]] page put it at the place where the instance you want to add classifies.
|-
|-
|<nowiki>{{Infobox instance/grey}}</nowiki>
|{{ic|<nowiki>{{Infobox instance/grey}}</nowiki>}}
|Same, but if the instance doesn't meet the criteria for the [[Instances]] page.
|Same, but if the instance doesn't meet the criteria for the [[Instances]] page.
|Same.
|Same.
|-
|-
|<nowiki>{{Infobox Platform}}</nowiki>
|{{ic|<nowiki>{{Infobox platform}}</nowiki>}}
|Use on a Fediverse project's advanced page.
|Use on a Fediverse project's advanced page.
|This template is more complicated, use only if you are an experienced template editor
|This template is more complicated, use only if you are an experienced template editor
|-
|{{ic|<nowiki>{{Infobox toot}}</nowiki>}}
|Use to display a toot in an article
|Use on top of the page or section it belongs to.
|}
|}


Line 111: Line 147:
So e.g. for Template:Yes you'd have to use this code:
So e.g. for Template:Yes you'd have to use this code:


<nowiki>{|class="wikitable"</nowiki><br>
{{ic|<nowiki>{|class="wikitable"</nowiki>}}<br>
<nowiki>|{{Yes}}</nowiki><br>
{{ic|<nowiki>|{{Yes}}</nowiki>}}<br>
<nowiki>|}</nowiki>
{{ic|<nowiki>|}</nowiki>}}


{|class="wikitable"
{|class="wikitable"
Line 120: Line 156:
!How to use it
!How to use it
|-
|-
|<nowiki>{{Yes}}</nowiki>
|{{ic|<nowiki>{{Yes}}</nowiki>}}
|To display in a table that something exists.
|To display in a table that something exists.
|You can use e.g. <nowiki>{{Yes|alternative text}}</nowiki> to display "alternative text" instead of the ✔️.
|You can use e.g. {{ic|<nowiki>{{Yes|alternative text}}</nowiki>}} to display "alternative text" instead of the ✔️.
|-
|-
|<nowiki>{{No}}</nowiki>
|{{ic|<nowiki>{{No}}</nowiki>}}
|Same, for something that doesn't exist.
|Same, for something that doesn't exist.
|Same.
|Same.
|-
|-
|<nowiki>{{No?}}</nowiki>
|{{ic|<nowiki>{{No?}}</nowiki>}}
|Same, for something that probably doesn't exist or if you just want a slightly different background color for some reason.
|Same, for something that probably doesn't exist or if you just want a slightly different background color for some reason.
|Same.
|Same.
|-
|-
|<nowiki>{{Maybe}}</nowiki>
|{{ic|<nowiki>{{Maybe}}</nowiki>}}
|Same, for something that might exist.
|Same, for something that might exist.
|Same.
|Same.
|-
|-
|<nowiki>{{Bot}}</nowiki>
|{{ic|<nowiki>{{Bot}}</nowiki>}}
|Used e.g. in [[The climate justice movement in the Fediverse]] to indicate that an account is a bot
|Used e.g. in {{Internal link |target=Climate justice in the Fediverse}} to indicate that an account is a bot
|Same.
|Same.
|-
|-
|<nowiki>{{New}}</nowiki>
|{{ic|<nowiki>{{New}}</nowiki>}}
|Same, to indicate something is new. Has slightly different color than the Yes template.
|Same, to indicate something is new. Has slightly different color than the Yes template.
|Same.
|Same.
Line 152: Line 188:


Some examples are:
Some examples are:
* <nowiki>{{Mastodon}}</nowiki>
* {{ic|<nowiki>{{Mastodon}}</nowiki>}}
* <nowiki>{{Pleroma}}</nowiki>
* {{ic|<nowiki>{{Pleroma}}</nowiki>}}
* <nowiki>{{Fediverse}}</nowiki>
* {{ic|<nowiki>{{Fediverse}}</nowiki>}}
* <nowiki>{{ActivityPub}}</nowiki>
* {{ic|<nowiki>{{ActivityPub}}</nowiki>}}
* <nowiki>{{Tusky}}</nowiki>
* {{ic|<nowiki>{{Tusky}}</nowiki>}}
* <nowiki>{{Fedilab}}</nowiki>
* {{ic|<nowiki>{{Fedilab}}</nowiki>}}


and these look like this:
and these look like this:
Line 187: Line 223:
These are just used internally on Media pages. If you upload a file and select a license during upload they will be added automatically so ideally they should not have to ever be added manually, but actually there are lots of uploads without licenses defined, so they should be added afterwards.
These are just used internally on Media pages. If you upload a file and select a license during upload they will be added automatically so ideally they should not have to ever be added manually, but actually there are lots of uploads without licenses defined, so they should be added afterwards.


Use them like this: <nowiki>{{CC-by-4.0 |author= |source=}}</nowiki>. For author just write the name of the license owner and for source you should enter a link or write "own" to indicate that the license owner is a member of this wiki. So e.g. if you upload a file that you created yourself and want to give it the CC-by-sa-4.0 license you should write: <nowiki>{{CC-by-sa-4.0 |author=Your username |source=own}}</nowiki>
Use them like this: {{ic|<nowiki>{{CC-by-4.0 |author= |source=}}</nowiki>}}. For author just write the name of the license owner and for source you should enter a link or write "own" to indicate that the license owner is a member of this wiki. So e.g. if you upload a file that you created yourself and want to give it the CC-by-sa-4.0 license you should write: {{ic|<nowiki>{{CC-by-sa-4.0 |author=Your username |source=own}}</nowiki>}}.


===Member templates===
===Member templates===
Line 193: Line 229:
Find them in [[:Category:Member templates]].<br>
Find them in [[:Category:Member templates]].<br>
Use them on your user page to indicate you are part of a project.
Use them on your user page to indicate you are part of a project.
===Templates for templates===
Find them in [[:Category:Templates for templates]].<br>
These are templates used to create many other templates. Use if you're an experienced template editor.


==What you should consider for translations==
==What you should consider for translations==
 
{{Draft section}}
coming soon


==How to create your own templates==
==How to create your own templates==
 
{{Draft section}}
coming soon


{{category |category=Editing guides}}
{{category |category=Editing guides}}

Latest revision as of 19:11, 14 November 2024

This page is supposed to explain to editors what templates are, how to use them and how to edit them.
Not all templates will be explained here, but you should get a general idea about how they work and then be able to use the others as well. You can find all templates in Category:Templates and sub-categories.

If you have any more questions ask User:Paula and she will answer you and then ideally add the missing information to this guide as well.

What are templates?

Templates are generally just any content that is put into a page in the template namespace (pages that start with Template:) and can be used in any other page by simply writing the page name of the template in double braces.
So e.g. if you have a page called Template:Hello with the content "Hello world!" and you write {{Hello}} in any article then that will be displayed as "Hello world!".
Of course templates are rather used for more complicated things than just a short piece of text. See examples below.

How to use existing templates in an article

Beware: If you use any template make sure it displays correctly after your edit:

  • The template displays at all and not just as "Template:Example" in red text
  • There are no broken links or images in the template
  • There are o missing parameters that display e.g. as {{{parameter}}}
  • The template is in the right position
  • Ideally: There are no redundant line breaks

With the graphical editor

When you use the graphic editor (when you click "edit" and not "edit source") there are two ways to insert a template. You can either just type {{ and a popup will let you choose which template you want to use or you choose "Insert" in the menu above and then "Template".
Anyway you'll then usually get a popup asking you for some parameters. Some of them have to be filled, others are optional. On the left side you'll be able to add more parameters that are available, but might not usually be needed.
This depends on the template having template data defined, which not all have (yet).
There are also very simple templates like {{Mastodon}} which will never get template data, because they don't have parameters and can only generate one result. In this case that is:

Mastodon

With the source editor

If you use the source editor you have to type in the name of the template in the correct capitalization within double braces. So e.g. {{Mastodon}} for the example above.
If the template uses parameters you have to write them in the braces as well like this: {{Template name |parameter 1=example |parameter 2=example 2}}.

Examples

Here's a list of some templates and how to use them.

Basic templates

See Category:Basic templates

We do some things differently in this wiki than elsewhere, because we use the translate extension and not have different wikis in every language (like Wikipedia).
The following two templates make sure that links and categories also work on translated pages.

Internal links

For internal links, instead of e.g. [[Main Page]] to link to the Main Page we use {{Internal link |target=Main Page |link-name=Main Page}}.

Categories

Instead of [[Category:Category name]] to add a category to a page we use {{category |category=Category name}}.

Code

To put some code inside a grey box like example code just write {{Ic|example code}}.

Warning small

To make a ❗️harsh warning❗️ just write {{Warning small|harsh warning}}. In this case harsh warning is a custom text, by default {{Warning small}} just puts out ❗️Warning❗️.

Navbar

Many pages display a navbar on the bottom, but not in mobile view. To add this to the page just put {{Navbar}} on the bottom of the page. If it's a page about a software project, e.g. Mastodon, then use e.g. {{Navbar/Mastodon}} instead.

Language switch

This one is rarely needed for basic editing. It simply puts a slash followed by the language code in the text. So e.g. /en, /de, /ja, /he, ...
To use it simply put {{Language switch}} in the code.

Content templates

See Category:Content templates.
These are templates that are simply used to put something in many articles without having to edit each article every time the content updates.

They are:

Infobox templates

Find all of them in Category:Infobox templates.
Generally these are mostly used for tables that float on the right side of an article and display basic info about the subject of the article.

Name When to use it How to use it
{{Infobox}} For use in Category:Fediverse projects articles. Put it on top of the article, or if there are already <translate> tags then put it right below <languages/><translate>. Write the first paragraph of the article right below the template - no line breaks.
{{Infobox discontinued}} Same, but for Fediverse projects that are no longer maintained. Same.
{{Infobox app}} Use in Category:Apps articles. Same as above: On the very top of the article except articles with translate tags.
{{Infobox app short}} Same, if there are no media files for the app uploaded yet. Same.
{{Infobox book}} Infobox about books by fedizens. Same.
{{Infobox instance}} Use on an instance's own page in the Instance: namespace and on the Instances page. On the instance's page put it on top, on the Instances page put it at the place where the instance you want to add classifies.
{{Infobox instance/grey}} Same, but if the instance doesn't meet the criteria for the Instances page. Same.
{{Infobox platform}} Use on a Fediverse project's advanced page. This template is more complicated, use only if you are an experienced template editor
{{Infobox toot}} Use to display a toot in an article Use on top of the page or section it belongs to.

Table cell templates

Find all of them in Category:Table cell templates.
Here is how they look:

✔️ ✖️
No?
🤖 🆕

These have to be used in tables.
If for some reason you ever wanted to use them standalone you'd have to wrap a basic table around them.
So e.g. for Template:Yes you'd have to use this code:

{|class="wikitable"
|{{Yes}}
|}

Name When to use it How to use it
{{Yes}} To display in a table that something exists. You can use e.g. {{Yes|alternative text}} to display "alternative text" instead of the ✔️.
{{No}} Same, for something that doesn't exist. Same.
{{No?}} Same, for something that probably doesn't exist or if you just want a slightly different background color for some reason. Same.
{{Maybe}} Same, for something that might exist. Same.
{{Bot}} Used e.g. in Climate justice in the Fediverse to indicate that an account is a bot Same.
{{New}} Same, to indicate something is new. Has slightly different color than the Yes template. Same.

Project, protocol and app templates

Fin them in Category:Software templates, Category:Protocol templates and Category:App templates.
Like the table cell templates above these are used in tables or have to be wrapped in basic tables otherwise as explained above.
See them in use e.g. in The Fediverse in the Fediverse in the last column.

Some examples are:

  • {{Mastodon}}
  • {{Pleroma}}
  • {{Fediverse}}
  • {{ActivityPub}}
  • {{Tusky}}
  • {{Fedilab}}

and these look like this:

Mastodon Pleroma Fediverse
ActivityPub Tusky Fedilab

Warning templates

Find all of them in Category:Warning templates.
These are used on the top of articles to indicate that the article lacks some quality criteria.
They should only be used by people that are part of Project:Quality control after consulting with the oters.

Portal templates and subtemplates

Find them in Category:Portal templates and Category:Subtemplates.
These are templates used to edit sections of the Main Page or pages in Category:Portals.

License templates

Find them in Category:License templates.
These are just used internally on Media pages. If you upload a file and select a license during upload they will be added automatically so ideally they should not have to ever be added manually, but actually there are lots of uploads without licenses defined, so they should be added afterwards.

Use them like this: {{CC-by-4.0 |author= |source=}}. For author just write the name of the license owner and for source you should enter a link or write "own" to indicate that the license owner is a member of this wiki. So e.g. if you upload a file that you created yourself and want to give it the CC-by-sa-4.0 license you should write: {{CC-by-sa-4.0 |author=Your username |source=own}}.

Member templates

Find them in Category:Member templates.
Use them on your user page to indicate you are part of a project.

Templates for templates

Find them in Category:Templates for templates.
These are templates used to create many other templates. Use if you're an experienced template editor.

What you should consider for translations

This section is a draft or missing!
The section still has to be written or at least a lot more information added.


How to create your own templates

This section is a draft or missing!
The section still has to be written or at least a lot more information added.