CURRENT MISSION: Conclude the 2026 soyjak.party hack page, aswell as any pages relating to it, such as the Summer 2026 Crisis page.
Update Quotecord with any relevant info. See the blackboard for more info.

Soyjak Wiki:Template Manual of Style: Difference between revisions

From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search
MarketPliers (talk | contribs)
North (talk | contribs)
Line 24: Line 24:
* Add the {{tlc|Documentation}} template wrapped in a <code><nowiki><noinclude></nowiki></code>, typically at the bottom.
* Add the {{tlc|Documentation}} template wrapped in a <code><nowiki><noinclude></nowiki></code>, typically at the bottom.
* Once added there's a dedicated button to [create] the documentation subpage.
* Once added there's a dedicated button to [create] the documentation subpage.
* Here you will add the <code><nowiki><templatedata></nowiki></code> tag, in which you can write a [https://en.wikipedia.org/wiki/JSON JSON] object that describes the template and it's parameters. The object is generally structured like this:
* Here you will add the <code><nowiki><templatedata></nowiki></code> tag, in which you can write a [wikipedia:JSON|] object that describes the template and it's parameters. The object is generally structured like this:
<pre>
<pre>
<templatedata>
<templatedata>

Revision as of 14:03, 5 March 2026

This page provides a set of basic pointers on the creation of templates. New users should avoid making templates because they are highly likely to be coal.

Templates are supposed to be used on multiple articles, therefore templates have a higher standard than articles.

Types of templates

See: Soyjak Wiki:Template

Usecase

This is the single most important aspect of a template. Why should your new template exist and be used? Does it justify the vertical space taken up on the article? Is there another template that already has the same purpose? You need to consider these questions before you even begin making your template, or it may be deleted.

Certain kinds of templates, like "has connections to or written by" style templates, are especially regarded as superfluous.

Code

  • The template should not use inefficient code like spamming <big> multiple times instead of using font-size.
  • If possible, the template should be a single cell or div that does not use rowspan in order to minimize wasted vertical space brought about by cellpadding and cellspacing and improve readability.
  • The template should have a margin of 5px auto if it is a header or footer. This is simply to match the margins of most other templates.
  • All colors should be in hexcode. For transparent colors, use 8 digit hex notation instead.
  • Add suitable categories such [[Category:Template]] to the template page itself via <noinclude>. Make sure not to leave a newline between the noinclude and the template code or it might stack up with another newline from a different template being transcluded once it is on an article and cause an irremovable space to appear between templates and article text.
  • Use template parameters and parser functions in order to make the text of the template suitably customizable.
  • Write documentation, don't be a SLF and expect others to figure out how your template works by reading the code.

Documentation Pages

Documentation is key to any well made template, they not only help others maintain your template, but also tells all the nuswa using the visual editor how to use the template, and makes editing this very wiki a pain when it isn't done.

  • Add the {{Documentation}} template wrapped in a <noinclude>, typically at the bottom.
  • Once added there's a dedicated button to [create] the documentation subpage.
  • Here you will add the <templatedata> tag, in which you can write a [wikipedia:JSON|] object that describes the template and it's parameters. The object is generally structured like this:
<templatedata>
{
  "description": "A relevant description of what type of template this is.",
  "params": {
    "1": {
      "label": "Name of the parameter",
      "description": "Does a thing, makes it keyed o algo",
      "type": "string",
      "required": false
    }
  }
}
</templatedata>
  • Each parameter needs to have it's name be the same as it is in the template wikicode.
    • "label": Has to be set to a descriptive, user-friendly name, not just "1" like it is in the wikicode.
    • "description": Has to describe what the parameter does, and note any common pitfalls.
    • "type": Has to be set to the type of input it expects. "string" is the most common, other common types are "number", and "boolean" (true or false).
    • "required": Has to be either true or false depending on if the variable is required for the template to function properly.
    • "example": Is optional but highly encouraged, should be a valid example input to clear up any confusion in the description.

Templatestyles

<templatestyles> can be used to effectively manage and reuse your CSS code and allows for certain features like @keyframe animations and @media queries to change the layout of a template for mobile and desktop.

NOTE: Unlike some modern CSS frameworks, mediawiki templatestyles do not feature any kind of deduplication to avoid styling clashes from reused class names. Some care has to be taken in order to not disrupt other templates that use the same class names in the same article, as their styling will be overridden by the first <templatestyles> in the article. To avoid this you can prefix your class names or (in CSS) scope all generic class names to be a child of the parent class:

Bad

Good

.template-example {
  background-color: black;
}

.header {
  color: white;
}
This is bad as ALL templates on the page with using the class name of "header" will now be white.
.template-example {
  background-color: black;
}

.template-example .header {
  color: white;
}
This is good, now only the "header" class name that have the parent of "template-example" will be affected.
.template-example {
  background-color: black;
}

.template-example__header {
  color: white;
}
Prefixing is also acceptable.
  • Create a page for your CSS styling, usually as a subpage of your template: i.e. Template:Example/styles.css
  • When you've written your CSS you must change the content model from CSS to Sanitized CSS. (Mediawiki is pretty strict with what it considers "sanitized", so most nufeatures from 2020 and onwards are likely to be rejected.)
  • Add <templatestyles src="Example/styles.css"> to your template.
  • Add the {{Template styles}} with a link to the styles.css page in your Documentation for easier editing.

Visuals

  • Templates MUST be functional and aesthetically pleasing on phone screens.
  • The template should not have extremely saturated colors.
    • On hexadecimal color, consider adding to the other values to reduce saturation, or subtracting from your main (highest) color value.
  • Do not use dark fonts on dark backgrounds or light fonts on light backgrounds.
    • Otherwise it'll be hard to read.
    • If your text is hard to read, increase the contrast between text and background colors on all three values, by at least 3 levels.
  • The template should not be excessively tall or wide.
  • The template should not be overly eye-catchy or flashy to the point that it looks headache-inducing or overstimulating to look at.
  • You should not make an upgraded (aka. "worse") version of existing templates unless necessary, as it will "award" the thing it is talking about. For example, see: {{Superpedo}}
  • Use suitable padding so that template contents do not encroach upon borders.

{{HyperDoctos}} is an example of what a really bad template looks like. If you unironically make and/or use a template like this we VVILL do unspeakable things to you.

Soyjak Wiki Guides and Policies

Guides:
Manual of Style (Template Manual of Style) - Beginner's guide - About - Staff - Bots - Coal articles - Collapsing objects - Morphing objects - Random objects - Galleries

Policies:
Rules - Moderation - Privacy policy - Policy - Approver policy - Copyright - Edit war