Join the Fediverse:Template guide: Difference between revisions

m
m (Text replacement - "Category:Subtemplate" to "Category:Subtemplates")
 
(22 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===


Find all of them in [[:Category:Infobox template]].<br>
Find all of them in [[:Category:Infobox templates]].<br>
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.
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.


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:What are 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 defunct}}</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 instance}}</nowiki>
|{{ic|<nowiki>{{Infobox app short}}</nowiki>}}
|Same, if there are no media files for the app uploaded yet.
|Same.
|-
|{{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 Platform}}</nowiki>
|{{ic|<nowiki>{{Infobox instance/grey}}</nowiki>}}
|Same, but if the instance doesn't meet the criteria for the [[Instances]] page.
|Same.
|-
|{{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 101: Line 145:
These have to be used in tables.<br>
These have to be used in tables.<br>
If for some reason you ever wanted to use them standalone you'd have to wrap a basic table around them.<br>
If for some reason you ever wanted to use them standalone you'd have to wrap a basic table around them.<br>
So e.g. for Template:Yes you'd have to use this code:<br>
So e.g. for Template:Yes you'd have to use this code:
<nowiki>{|class="wikitable"</nowiki><br>
 
<nowiki>|{{Yes}}</nowiki><br>
{{ic|<nowiki>{|class="wikitable"</nowiki>}}<br>
<nowiki>|}</nowiki>
{{ic|<nowiki>|{{Yes}}</nowiki>}}<br>
{{ic|<nowiki>|}</nowiki>}}


{|class="wikitable"
{|class="wikitable"
Line 111: 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 [[The climate justice movement 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 138: Line 183:
===Project, protocol and app templates===
===Project, protocol and app templates===


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


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 170: Line 215:
===Portal templates and subtemplates===
===Portal templates and subtemplates===


Find them in [[:Category:Portal template]] and [[:Category:Subtemplates]].<br>
Find them in [[:Category:Portal templates]] and [[:Category:Subtemplates]].<br>
These are templates used to edit sections of the [[Main Page]] or pages in [[:Category:Portals]].
These are templates used to edit sections of the [[Main Page]] or pages in [[:Category:Portals]].


===License templates===
===License templates===


Find them in [[:Category:License template]].<br>
Find them in [[:Category:License templates]].<br>
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===


Find them in [[:Category:Member template]].<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}}