Jump to content

Join the Fediverse:Template guide: Difference between revisions

m
no edit summary
mNo edit summary
Line 8: Line 8:


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 16:
* 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 25:
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 32:
===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 48: Line 48:
====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>}}.


===Infobox templates===
===Infobox templates===
Line 64: Line 64:
!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 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 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
Line 113: Line 113:
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 122: Line 122:
!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 154: Line 154:


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 189: Line 189:
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===